Some Important Javascript Interview Topics

Md Nakibul hosen Nahid
3 min readMay 8, 2021

Hello coders! In todays blog I will explain some important topics about javascript interview. Let’s get started!

Photo by Karolina Grabowska from Pexels

1 ) Truthy value :

In javascript truthy value is something that considered as true in boolean counter. We have a plenty number of truthy value. Expect some Falsy value everything is considered as a truthy value. For example a string can be a truthy value, true keyword itself is a truthy value

2) Falsy value :

We can define falsy value as the same way we defined falsy value. In javascript falsy value is something that considered as false in boolean counter. There is a small number of falsy value. They are :

false, 0, -0, 0n, null, undefined, NaN

Important Related Topic : coercion, type conversion or typecast, type of coercion, implicit coercion vs explicit coercion

3) Null :

In javascript null is value that means nothing. You can assign a variable to null. For example :

var x = null;
alert(x); //null

4) Undefined :

In javascript undefined means an undefined variable. It means that you have declared a variable but haven't assigned a value to it. For example :

var x;
alert(x); //undefined
function hello(x){
alert(x)
}
hello() //undefined

5) Key difference between null and undefined :

The main difference between null and undefined is null is a assigned value where undefined is not. Undefined itself is a type and null is an object.

6) == vs === in Javascript :

In javascript we have two relational operator to compare two values if they are same or not. We often call it double equal and triple equal. Then what are the main difference between this two operator? The double equal compare two values but the tripple equal compare both value and data type. Let's see an example

console.log(2=="2"); //true
console.log(2==="2"); //false

In double equal javascript implicitly convert the data type as the two values are same. So if the value is same then it's true.
Now you may have a question what is implicit conversation? It's data type conversion. The will be converted to the expected data type by javascript. You don't have to write any code for this. On the other hand in explicit conversion you have to write code to convert data type. For example :

Number("2"); //2

7) Scope :

Scope is a very important concept in a programming language. Scope means the accessibility of variable or function. In javascript there are two type of scope
1. Local scope
2. Global scope

Local scope means it can be used within that part of the code. May be within a function or within a if statement. On the other hand global scope means it can be used anywhere in the code.

8 ) Difference between java and javascript :

Java and Javascript is totally different from each other. They have different use case. Javascript is a scripting language whether java is a full functional programming language. Both have different syntax too.

9) Loop in javascript :

It’s a very common question in javascript interviews that tell me about the loops in javascript. The answer is :

  1. for loop
  2. while loop
  3. do while loop

10 ) Run Javascript Server :

It’s also a familiar question in javascript interview that can you run javascript in server side? The answer is yes! we can. Node.js make this possible for us.

--

--

Md Nakibul hosen Nahid

I am a Web developer. I make all kind of awesome websites.