Implicit Coercion II
2022年5月1日小于 1 分钟
Implicit Coercion II
Question
What does the code snippet to the right output by console.log
?
Snippet
console.log([] + [])
console.log([] + 1)
console.log([[]] + 1)
console.log([[1]] + 1)
console.log([[[[2]]]] + 1)
console.log([] - 1)
console.log([[]] - 1)
console.log([[1]] - 1)
console.log([[[[2]]]] - 1)
console.log([] + {})
console.log({} + {})
console.log({} - {})