Single Choice
Easy
QWhat is the result of the following code?
var x = 10;
var y = 20;
console.log(x ^ y);
ID: #4899
JavaScript Operator MCQ
175 views
Question Info
#4899Q 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 is the bitwise XOR operator, which performs a bitwise XOR operation on its operands.
In this case, the ^ operator is called on x and y, with x as the first operand and y as the second operand.
Since x is 10 and y is 20, the result of the ^ operator will be the bitwise XOR of the binary representations of 10 and 20, which is 30 in decimal.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic