Single Choice
Easy
QWhat is the result of the following code?
var x = true;
var y = false;
console.log(x || y);
ID: #4890
JavaScript Operator MCQ
308 views
Question Info
#4890Q ID
EasyDifficulty
JavaScript Operator MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The || operator in JavaScript performs a logical OR operation on its operands.
If either operand is truthy, the result is true, otherwise the result is false.
In this case, the first operand (x) is truthy (true), so the result of the || operation is true, regardless of the value of the second operand (y).
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic