What do you mean by data attributes and why it is used?
HTML 5 has “data-*” which are custom attributes defined by the developer. They are used when any existing characteristic is not suitable to be used. These attributes are only used on the page they are written on, and they do not need AJAX calls.
These are Global attributes, so they can be applied to any element.
Point to be noted: Go through this Q&A very thoroughly as this is one of the essential full stack developer interview questions.