C

Chandani • 10.97K Points
Tutor II

Q. What will be logged?

Code:
console.log('2' - '1');
  • (A) 1
  • (B) 11
  • (C) NaN
  • (D) Error
  • Correct Answer - Option(A)
  • Views: 14
  • Filed under category JavaScript

Explanation by: Chandani
The - operator coerces both strings to numbers.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics