Single Choice
Not Set
QWhat is the result of the following code?
console.log(5 - '5');
ID: #4861
JavaScript Operator MCQ
300 views
Question Info
#4861Q ID
Not SetDifficulty
JavaScript Operator MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The result of the code is 0 .
In JavaScript, the - operator performs subtraction if both operands are numbers. .
In this case, the string '5' is converted to the number 5, so the final result is 5 - 5 = 0..
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic