So, your first line of code is invalid JavaScript syntax. This is why you get:
ReferenceError: Invalid left-hand side in assignment(You cannot assign vars to null)
The second line - this syntax, but throws:
ReferenceError: foobar is not defined.
, , - , , JavaScript , , .
, @Matt:
JavaScript . , .
, JavaScript, , , , ? , unatchable Error ( SyntaxError ReferenceError). , , - try/catch , , .