I have noticed different behavior in NodeJS vs. Browser while screwing around with automatic semicolon insertion and type casting.
Browser:
> {}+{}
NaN
> {}+{};
NaN
> ({}+{})
"[object Object][object Object]"
> ({}+{});
"[object Object][object Object]"
NodeJS:
> {}+{}
'[object Object][object Object]'
> {}+{};
NaN
> ({}+{})
'[object Object][object Object]'
> ({}+{});
'[object Object][object Object]'
A. Why is casting interpreted differently with/without a semicolon or in parenthesis?
B. Which is more compliant to the standard? Or is this not addressed in the standard?
UPDATE: I found that it only does this different behavior in NodeJS. I previously thought this was V8 vs SpiderMonkey.