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
Tag: semantics
JavaScript: difference between a statement and an expression?
I asked this question earlier, and after thinking about the topic some more, I began to wonder where the seemingly fuzzy boundary between the meanings of the terms “statement” and “expression” lies. Are all statements also expressions? Where do the return values in a REPL console come from? They don’t always seem to make any intuitive sense. Of course, if