Top 10 JavaScript Interview Questions and Answers for 2021

Iftekhar Hossain
3 min readMay 8, 2021


  1. What are the differences between == and ===?

Answer: == means it will check for the equality condition and === means it will check for the equality condition and data type.

2. how to remove duplicate items in an array?

Answer: Frist I will create a new empty array and I will run loop all items of original array. At the same time, I will make a conditional to check the new item is exist or not. Then I will push the item into my new array.

let itme = [ 1, 3, 5, 7, 33, 2, 3, 7, 44, 5]
let uniqueItem = [];
for(var i = 0; i<item.length; i++){
var element = name[i];
var index = uniqueItem.indexOf(element);
if(index == -1){

3. Explain Event bubbling in javascript?

Answer: Event bubbling is a type of event propagation. When we clicked DOM child element event handler. Then Tried to others all parent element handler clicked.

4. Explain this keyword in javascript?

Answer: The javascript this keyword refers to the value of the currently executing object. It's depending on where it is used. In a function, this refers to the global object.

5. Explain New Keyword in javascript?

Answer: javascript New keyword created empty object from class.

class Person {
constructor(name){ = name;
var name = New Person();

Look at the example, I have created an object of Person using New keyword. This Person() is called a constructor function.

6. Different between undefined and null in javascript?

Answer: undefine — In javascript undefined means variable declared but the value has not yet assigned. There are many ways have to find undefined.

let fun = undifine;
Example: 2
let Iftekhar;
Example: 3
function add(num1, num2){
console.log(num1, num2)
Example: 4
let ages = [11, 33, 44];

Null — null in JavaScript is an assignment value. You can assign it to a variable.

var demo = null;

7. What is the CallBack function in javascript?

Answer: A callback function is a function passed as an argument to another function, This function runs after another function has finished.

function explain_callBack(name, age, task){
console.log('hello', name);
console.log('your age', age);
function washHand(){
console.log('wash hand with soap')
function takeShowar(){
console.log('take shower')
explain_callBack('Rohim' 20, washHand);
explain_callBack('Korim' 15, takeShowar);

8. What is ES6?

Answer: ES6 refers to version 6 of the ECMA Script programming language. ECMAScript 6 is also known as ES6 and ECMAScript 2015. The current ES version supported in modern browsers is ES5.

9. Explain Some new features in ES6?

Answer: ES6 are some awesome features. like:-

We got let and const for instead var, let and const supported block scope.

We got Arrow function. it's easy and shortest than the regular function.

We got template string, Template strings provide syntactic sugar for constructing strings.

We got Destructuring, Destructuring allows binding using pattern matching, with support for matching arrays and objects

10. What is the difference between the Regular function and the Arrow function?

Answer: Arrow functions do not have arguments binding. But the regular function has arguments binding.

Arrow function can’t use as a constructor, and arrow function does not have an argument object too, etc.



Iftekhar Hossain

Front-end developer.