JavaScript · Senior · Question 62 of 75

What does [] + {} evaluate to?

Explanation

+ converts both operands to primitives: [] becomes "" and {} becomes "[object Object]", then strings are concatenated. Such coercions are why linters warn about mixed-type +.

Further reading

Problem with a question

JavaScript · Senior · question 62

Test yourself

Take the JavaScript · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz