Single Choice
Easy
QWhat is the result of the following code?
var num = 10;
num /= 5;
console.log(num);
ID: #4888
Javascript Data Types MCQ
193 views
Question Info
#4888Q ID
EasyDifficulty
Javascript Data Types 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 an assignment operator that divides the value of the left operand by the value of the right operand and assigns the result to the left operand.
In this case, the variable num is initially assigned the value 10, which is a number.
On the second line, num is divided by 5 using the /= operator.
The result of the division is 2, which is then assigned back to num.
Therefore, num now has a value of 2, and when it is logged to the console, the value 2 will be displayed.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic