DEV Community

Cover image for Essential Front-end Interview Questions.
Sam Sonter
Sam Sonter

Posted on


Essential Front-end Interview Questions.

1. Why are doctypes used in HTML?

Doctypes are not tags nor HTML elements but are document types declaration.
The documents are used or stated to tell the web browser about the html version or any markup language tha is used on the current page.

2. State ways of getting elements from a dom DOM.

  • getelementbyID

  • getelelementbyclassname

  • getelelementbyselector

  • getelelementbytagname

  • getelelementbyselectall

3. What is semantic HTML

Semantic HTML is used to to structure content appropriately so that they are displayed properly.
Structural content is what makes HTML pages readable. Also, properly structed content help search engnes understand web pages better and pushes the websites search rank higher.

4. What are the advantages of using CSS preprocessors?

  • CSS preprocessors facilitate adding variables and functions to increase code reusability.

  • CSS preprocessors makes code management easier.
    It allows grouping of parent amd child elements into modular blocks.

  • Multiple stylesheets can be joined into one, using CSS preprocessors.

5. List common use cases for anonymous functions

  • They are used as arguments in other functions.

  • They are used to create and invoke immediate invokable function expressions.

6. Describe session storage.

Session storage & Local storage. - as the name suggests, this data is stored until the session or tab is closed. However, it is not cleared during tab reloads.

Local storage - this data is stored on the clients computer. The data has no expiration
however, it is limited only to string data. Local data can be accessed using JavaScript and HTML but cannot be transfered to the server-end.

7. What are higher-order functions.

Higher-order functions are functions that operate on other functions. They either take other functions as arguments or return them.

Follow me on Twitter for more tips.

Top comments (0)