Single Choice Easy

QWhat is the result of the following code?
var x = true;
var y = false;
console.log(x && y);

ID: #4883 Javascript Data Types MCQ 190 views
Question Info
#4883Q ID
EasyDifficulty
Javascript Data Types MCQTopic

Choose the Best Option

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

  • A true
  • B false
  • C "false"
  • D "true"
Correct Answer

Explanation

The && operator in JavaScript performs a logical AND operation on its operands.
If both operands are truthy, the result is true, otherwise the result is false.
In this case, the first operand (x) is truthy (true), but the second operand (y) is falsy (false), so the result of the && operation is false.

Share This Question

Challenge a friend or share with your study group.