Which of the following statements will result in true when using the strict equality operator (===)?

Which of the following statements will result in true when using the strict equality operator (===)?

a) 5 === "5"
b) null === undefined
c) true === 1
d) 5 === 5

Answer:

d) 5 === 5

Explanation:

The strict equality operator (===) compares both the value and type of two variables. The statement 5 === 5 returns true because both the value and type (number) are the same.

Other comparisons, like 5 === "5", return false because the types differ.

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top