Skip to content
Advertisement

Tag: semantics

Why does [][[]] evaluate to undefined?

The expression [][[]] evaluates to undefined in JavaScript. My understanding of this was that the compiler sees the second set of […] and interprets that to be an array subscript operator (because you can’t have two arrays next to each other). So the compiler knows that the inner expression, [], must be an index, and so after evaluating it, it

Advertisement