What is the output of the following? “`js console.log([] + []); console.log({} + []); console.log([] + {}); “`

JavaScript Professional Medium

JavaScript Professional — Medium

What is the output of the following? “`js console.log([] + []); console.log({} + []); console.log([] + {}); “`

Key points

  • Concatenating two empty arrays results in an empty string
  • Coercing an object into a string results in '[object Object]'
  • Understanding type coercion in JavaScript is crucial

Ready to go further?

Related questions