JavaScript Interview questions


Total available count: 22
Subject - JavaScript Frameworks
Subsubject - JavaScript

What is the difference between == and === operator?

“==” is called equality operator and “===” is called Identity operator.
 The equality operator (==) will attempt to make the data types the same before proceeding. On the other hand, the identity operator (===) requires both data types to be the same.

var currentTime1 = 9;
var currentTime2 = "9";
console.log("Equality operator == ");
if (currentTime1 == currentTime2) {
    console.log("Both Time values are same");
} else {
    console.log("Both Time values are not same");
          }
console.log("Identity operator === ");
if (currentTime1 === currentTime2) {
    console.log("Both Time values are same");
} else {
    console.log("Both Time values are not same");
}

 

Result:
Equality operator == 
Both Time values are same
Identity operator ===
Both Time values are not same




Next 5 interview question(s)

1
Which symbol is used for comments in JavaScript?
2
What is a prompt box?
3
What is 'this' keyword in JavaScript?
4
What is NEGATIVE_INFINITY?
5
What is the use of isNaN function?