Question discussion

What is the output of the following JavaScript code?console.log([] == false, null == undefined, NaN == NaN, "1" == 1, null == 0);

1929Medium DSSSB TGT Computer Science 0 replies 1 views
0

What is the output of the following JavaScript code?

console.log([] == false, null == undefined, NaN == NaN, "1" == 1, null == 0);
  • Atrue true false true false
  • Btrue false false true false
  • Ctrue true true true false
  • Dfalse true false true true
Correct answer: A

Explanation

[] converts to 0 so equals false; null == undefined is true; NaN is never equal to itself; "1" converts to 1; null equals only undefined, not 0.

Discussion 0

Nobody has replied yet. Start the discussion!