Single Choice
Not Set
QWhat is the result of the following code?
let x = 10;
let y = '10';
console.log(x == y);
ID: #4856
Basic JavaScript MCQ
214 views
Question Info
#4856Q ID
Not SetDifficulty
Basic JavaScript MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The result of the code is true.
The == operator in JavaScript performs type coercion, which means that it converts the operands to the same type before performing the comparison.
In this case, the string '10' is converted to the number 10, so the comparison returns true.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic