Top 10 JavaScript Interview Questions

Top 10 JavaScript Job Interview Questions in 2021

1 What are the data types?

Supported by javascript we have primitive data types like string, boolean, number, bigint which can represent integers with arbitrary precision and define null symbol we also have object and functions.

2 Is JavaScript a case-sensitive language?

Yes, JavaScript is a case-sensitive language. The keywords, variables, function names, and any other identifiers must always be typed with a consistent capitalization of letters.

3 How can you create an object?

JavaScript supports object concepts very well. You can create an object using the object literal as follows in order to create an object use curly braces.

4 How can you create an array in JavaScript?

In order to create an array use square brackets.

5 What’s the difference between anonymous and name functions in javascript?

We can define function declaration by using the function keyword and provide the name of the function. When we assign the function to a variable using function keyword and anonymous function where we do not provide the name of the function which makes it a little bit more difficult to call them from other places.

6 How does the type of operator work?

The type of operator is used to get the data type of its operand, the operand can be either a litterer or a data structure such as a variable, a function, or an object. An arrow operator that is placed before its single operand which can be of any type its value is a string indicating the type of the operand.

7 How to create a cookie using JavaScript?

The simplest way to create a cookie is to assign a string value to a document.cookie object.

8 What’s the difference between double and triple equal operators?

JavaScript has two visually similar yet very different ways to test equality. You can test equality with double or triple. Equal sign here is the difference. When using a triple equals in javascript we are testing for strict equality which means that both type and the value we are comparing have to be the same. When we use a double equal sign javascript will try to convert values to a like type and then compare the values for that reason usually you would rather use a triple equal sign.

9 What are the different kinds of browser storage?

If you open developer tools and navigate to the application tab you can see which storages are available in a chrome web browser. So except for the cookies which you already know you can use local storage or session storage and some browsers but not all of them support internal databases like index database and Web SQL.

10 What is the difference between null and undefined?

In a nutshell, undefined typical means that the variable has been declared but not defined where null is assigned value and it means nothing other than that. Both null and undefined are primitives and they are both falsely values.

So these were the top 10 interview questions that you might hear on your very first interview for a junior developer role.

MERN Stack Developer | Full Stack Front End Web Developer | UI UX Designer | Machine Learning Enthusiast