HTML5 interview questions

There are some common but basic questions which are expected from a frontend developer, if you are a core JS developer then you should know these questions, so here it is ?

Sometimes we need to save data at client side to maintain session, reducing sever request by storing the data at client side. And this all can be achived using sessionStorage, localStorage and Cookies. Each one has its own storage and expiration limit.

Cookies are the very old method of storing data on client side while localStorage and sessionStorage introduced in HTML5.

cookies can be set locally through JS or by server request but having a limit of only 4kb, both localStorage and sessionStorage can store upto 5MB.Cookies are primarily for server-side reading and session management with predefined expiration set.

For complete differnce plese refer below table:

script – HTML parsing is blocked, the script is fetched and executed immediately, HTML parsing resumes after the script is executed.

script async – The script will be fetched in parallel to HTML parsing and executed as soon as it is available (potentially before HTML parsing completes). Use async when the script is independent of any other scripts on the page, for example, analytics.

script defer – The script will be fetched in parallel to HTML parsing and executed when the page has finished parsing. If there are multiple of them, each deferred script is executed in the order they were encoun­tered in the document. If a script relies on a fully-parsed DOM, the defer attribute will be useful in ensuring that the HTML is fully parsed before executing. There’s not much difference in putting a normal script at the end of body. A deferred script must not contain document.write.