Grammar for instanceof:
RelationalExpression instanceof ShiftExpression
per ECMA-262 Β§11.8 .
The punctuator { at the beginning of the statement is considered the beginning of a block, so the next one } closes the block and terminates the statement.
The next instanceof statement is the beginning of the next statement, but it cannot be at the beginning because it must be preceded by RelationalExpression, so the analyzer gets a surprise.
You need to force {} be treated as an object literal, putting something else at the beginning of the statement, for example.
({}) instanceof Object
source share