Most Popular JavaScript Interview Questions

Md Miyad Hossain
3 min readMay 8, 2021
Photo by Cytonn Photography on Unsplash

01. What is JavaScript?

JavaScript is a lightweight interpreted or just-in-time compiled programing language. It’s also prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative.

2. What is DOM?

DOM stands for Document Object Model. It’s prepared to ready JavaScript object from HTML file for easily can take access, modify or update in future real-time access when the browser parses or read any HTML files.

3. What is the difference between null & undefined?

Undefined:
A few ways to get undefined such as not assigned variable’s value, not passed the function parameter, and searched non-existing array elements.
Null:
Null means an empty or non-existent value. Null is assigned and explicitly means nothing.

4. What is the difference between the operators ‘==‘ & ‘===‘?

Double equal(‘==’) only compares the values and it has also an internal algorithm. It’s trying to convert one similar value from two different values and checking similar values between two values, if get a similar value it’s passed the “true”.
And Triple equal(‘===’) used to compares both values and types.

5. What is the Event Loop?

In JavaScript, there has an event loop that maintains a queue or waiting line and also has a stack of tasks. It’s kept tasks stack-wise and firstly executed the top task of the stack and then consistently executed the rest tasks. After finished all tasks synchronous-wise then it executed tasks from the queue. This is entire working process is called Event Loop.

6. What is Closure?

A closure is a feature in JavaScript where a function has access to its outer function scope even after the outer function has returned. In summary, after the function has returned a closure can remember and access variables, arguments to its outer function.

7. What is Callback Function?

In JavaScript, a callback function passed to some method as an argument. After another function has executed then its function will be executed and this is called the Callback Function.

8. What is “this” keyword in JavaScript?

The “This” keyword references the object that is currently calling the function.

9. What is recursion in JavaScript?

A recursive function is a function that calls itself until it doesn’t. And this technique is called recursion. JavaScript allows calling functions recursively.

10. What are the differences between declaring variables using var, let, and const?

Before the advent of ES6, only the keyword var was used to declare variables. But with the ES6 version let and const were introduced new keywords of variables.
Var — Var variable can access from anywhere scope and can be updated and re-declared.
Let — Let variable declared in the block is only available for use within that block and it can be updated but not re-declared.
Const — As like Let declaration, Const variable can only be accessible within the block where it declared and it can’t be updated or re-declared.

--

--