Detailed answer
Data attributes attach application-specific information to an element and are available through dataset.
Values are strings, so parse them deliberately when code expects another type. Keep them separate from native semantic attributes. Anything placed in HTML is visible to the visitor; these attributes are not secret storage.
Example
<button type="button" data-example-id="forms-01">Open example</button>
Understanding the behavior
Data attributes store application-specific strings on elements. Dataset maps attribute names to JavaScript property names, but values remain strings until explicitly parsed. These attributes are visible to visitors and are unsuitable for storing secrets.
Practical implementation notes
Check how data-item-id becomes dataset.itemId, then validate values before using them. A value of false is still a non-empty string, so a simple truthiness test may not express the intended boolean state.
How to check it
Read button.dataset.exampleId and inspect its type before using it.
Expected result
The value is a string; numeric and boolean meanings need deliberate conversion.
Watch out: A dataset value of false is still a nonempty string unless parsed.
Read the reference ↗