This is because {} in the code is not an object literal, but an empty block.
It is analyzed as:
{}; // empty block + []; // this result is shown in the console
Compare with ({}) + [] , which gives the same results as [] + {} ; in this case, the bracket {} processed / parsed "in the context of the expression".
There is a bunch of duplicates on SO about this particular dual nature {} (like an expression or a block?), But finding them can be a little tricky.
I found https://meta.stackexchange.com/questions/83911/how-do-i-search-stackoverflow-for-at-keywords-like-private-or-synthesize on Meta, and using Symbolhound, "closest" duplicates that I could find resolved around questions like this (which are related to the need to add brackets when "eval'ing JSON") or this (where using constructs like "{} == false" is a syntax error).
If someone knows the best way to search for SO for this sort question or has a link to such a duplicate, convenient ..
user166390
source share