Q. What will be the output of the following code?

Code:
console.log(2 + '2');
  • (A) 4
  • (B) 22
  • (C) NaN
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 22
Explanation: JavaScript coerces the number 2 to a string and concatenates, resulting in '22'.
Explanation by: Chandani
JavaScript coerces the number 2 to a string and concatenates, resulting in '22'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
96
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Chandani
Publisher
πŸ“ˆ
80%
Success Rate