Single Choice Not Set

QWhat is the result of the following code?
let x = 10; let y = '10'; console.log(x === y);

ID: #4857 Basic JavaScript MCQ 213 views
Question Info
#4857Q ID
Not SetDifficulty
Basic JavaScript MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A True
  • B False
  • C 10
  • D '10'
Correct Answer

Explanation

The result of the code is false.
The === operator in JavaScript performs a strict comparison, which means that it not only checks for equality,
but also checks for type equality.
In this case, the operands x and y have different types (one is a number and the other is a string), so the comparison returns false.

Share This Question

Challenge a friend or share with your study group.