MCQ Single Best Answer Not Set

QWhat is the result of the following code?
console.log(5 * '5');

ID: #4862 Basic JavaScript MCQ 236 views
Question Info
#4862Q ID
Not SetDifficulty
Basic JavaScript MCQTopic

Choose the Best Option

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

  • A 25
  • B '5'
  • C '0'
  • D '55'
Correct Answer: Option A

Explanation

The result of the code is 25.
In JavaScript, the * operator performs multiplication if both operands are numbers.
In this case, the string '5' is coerced to the number 5, so the final result is 5 * 5 = 25

Share This Question

Challenge a friend or share with your study group.