$ ./guess_the_languageProblem Solving — predict the output
Problem Solving — predict the output · medium · #165

What is the output?

console.log([] + {}, typeof ([] + {}));
  1. [object Object] string
  2. [object Object] object
  3. {} string
  4. NaN string
Both operands stringify: '' plus '[object Object]', and the result is a string.
Play Problem Solving ▸