JavaScript MCQ JavaScript Operator MCQ Question #4890
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

Choose the Best Option

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

  • A true
  • B false
  • C "true"
  • D "false"
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).

Share This Question

Challenge a friend or share with your study group.