JavaScript code: console.log(parseInt("10.5") + parseInt("5.7") + "2"); What…

2025

JavaScript code:

console.log(parseInt("10.5") + parseInt("5.7") + "2");

What is the output?

  1. A.

    152

  2. B.

    17.7

  3. C.

    16.2

  4. D.

    152.7

  5. E.

    NaN

Attempted by 18 students.

Show answer & explanation

Correct answer: A

Correct answer: 152.

parseInt("10.5") gives 10 and parseInt("5.7") gives 5. The numeric addition happens first: 10 + 5 = 15. Then 15 + "2" performs string concatenation, producing "152".

Explore the full course: Up Police Computer Operator