The Most Common JavaScript Interview Questions for Junior Developer

1. Null vs Undefined

Null and Undefined are both special data types in Javascript. Usually, when we unintentionally do not assign a value to a variable, it’s considered undefined. We don’t have to assign any value for undefined. if it does not get the value in the variable, it is taken as undefined.

and Null is the complete opposite of undefined. We use null when we want to leave the value of the variable empty. Null is to be assigned as the value of the variable. The null is usually used to empty the former value or to come up with a value in the mountain.

example:

2. Truthy vs Falsy value.

Truthy and falsy Trams are very important in JavaScript. It returns results based on Boolean, either true or false. It helps a lot in building the logic of our programming.

Usually, the Falsy values are 0, false, null, undefined, white space, NaN, Empty String. Besides all are the rest is the Truthy value like 1, -1, “0”, true, Empty Object/ Array, etc.

3. Double equal vs Triple equal.

Double equal( == ) and Triple equal ( === ) term are also very important and useful in javaScript. This is called a comparison operator in the language of programming. Basically, Double equal is not that much strict than Triple equal. Double equal checks the only value of two statements and return its result. And by Triple equal its check value and type also then return results.

example:

4. Scope in Javascript.

In programming, scope usually refers to the context to which the power of a variable can be accessed. There are two types of scope, global and local. The Global Scope can be used from anywhere in the program. Although it has a lot of power, it still causes a lot of confusion among programmers. It is better to ignore it as much as possible. And Local scope ar very friendly for a programmer. It has to be declared inside the curly bracket, then a local scope is created.

5. Regular Function and Arrow Function.

Regular functions have been used since the release of Javascript but with the advent of ES6 the Arrow function has emerged as a new feature. it has some as a solution to many problems of the past regular function. Such as removing the confusion of javascript “this” terms and shortening the function etc.

6. Callback Function.

Callback Function means in a word it is a function that is executed after another function is executed. Inside a function, another function can be given as a callback Which makes the code much more reusable.

example:

7. Let vs Const in Javascript

In the past, var was used to assign variables in JavaScript. But later ES6 introduced us to the new let and const. It can help easily assign to blocked variables.
The main difference between let and const is that the value of the variable that will be declared with const can no longer be updated but will go with let.

8. Map in Javascript

Map did not exist in any previous version of Javascript. This is a new method that came with ES6. It is very easy to irritate the Array and it is used a lot.

9. Spread Operator in JavaScript

Another smart thing in spread operator JavaScript’s ES7. The real job of a spread operator is to scatter any repetitive data such as arrays or strings within their own position.

example:

10. Destructuring in JavaScript

The main function of destructuring is to separate the data from a data structure such as an array or an object. It’s a look like magic and makes the programmer’s job a lot easier.

example:

MERN-Stack Developer