Some ultimate JavaScript questions & answers for interviews that you should know

Md. Injamul Alam
2 min readMay 8, 2021

--

An interview is a primary path or a stage of a job. Most of the people feel too nervous about the interview. For a new or fresher web developer, it is so much important to good or well perform in the interview. So, in this post, I am discussed some essential interview questions and solutions for a beginner web developer.

Q1. What is the difference between double equal (==) and triple equal (===) ?

Double equal (==) VS Triple equal (===)

I will try to explain this to you very simply and briefly, I hope you will understand better.

We know that double equal (==) and triple equal (===) both are called comparison operators.

Double equal (==) is used for comparing two variables, but it checks that the equality of two operands without considering their datatype.

In triple equal (===) is used for comparing two variables, but it checks that the equality of two operands with considering their datatype.

When we use triple equal in javascript that we are testing for strict equality. This means both the datatype and the value we are comparing have to be the same.

For example:

Double equal (==)

2==2 // True

2 == ‘2’ // True, auto type coercion, string converted into number

0==false // True, because false is equivalent of 0

1== true // True, because true is equivalent of 1

Example of Double equal (==)

Triple equal (===)

2 ===2

// True, because both are number types and the same value.

2 === ‘2’

// False, because 2 is a number type and ‘2’ is a string both are not the same datatype.

0===false or 1=== true // both are false, because both operands are of different type

Example of Triple equal (==)

--

--