3 ms·
Yes! JavaScript is even more watty than you wat! Your context is implicitly parenthesizing the expressions you are evaluated, treating them as expressions rath
by crdrost 4y ago
Yes! JavaScript is even more watty than you wat!
Your context is implicitly parenthesizing the expressions you are evaluated, treating them as expressions rather than statements. Statements are also expressions of a sort too in JavaScript so uh there's also that. Here's the full wat matrix:
> do {[] + []} while (false);
''
> do {[] + {}} while (false);
'[object Object]'
> do {{} + []} while (false);
0
> do {{} + {}} while (false);
NaN
> do {([] + [])} while (false);
''
> do {([] + {})} while (false);
'[object Object]'
> do {({} + [])} while (false);
'[object Object]'
> do {({} + {})} while (false);
'[object Object][object Object]'
(as a hint, `{} + []` is actually `{}; +[]`, that is not an addition operator in that context).