I have been trying to find an explanation as to why the expression Boolean(false)+[]
evaluates to "false"
in JavaScript. I can see that the +
operator can be concatenation or addition depending on the types or the left and right hand, but can't seem to find a good explanation as to how does the empty array literal []
turn into string
in this case.
I was looking at the following:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Addition
https://tc39.es/ecma262/#sec-addition-operator-plus or section "12.8.3 The Addition Operator (+)"