What will the console.log([] + []) statement output?

What will the console.log([] + []) statement output?

a) ""
b) []
c) undefined
d) NaN

Answer:

a) ""

Explanation:

In JavaScript, when two empty arrays are added together, the result is an empty string "". This is because JavaScript first converts the arrays to strings, and the string representation of an empty array is an empty string.

Reference:

JavaScript MCQ (Multiple-Choice Questions)

Scroll to Top