|
|
|
|
|
by esrauch
2245 days ago
|
|
> In JavaScript, {} + [] evaluates to integer 0. This not really true. Put this js console and you'll see that a is the string "[object Object]": a = {}+[]
When you put just {}+[] in your console its doing an empty block followed by unary-plus,like: {/*do nothing block*/}; +[]
|
|
I guess JS’s parser explicitly prohibits adding things to a curly-brace enclosed entity?
I’m normally quite defensive of JS, but I’ll have to admit I don’t like that.