Editing this answer to make the exhaustive list.
Yes:
notexists;
notexists++;
notexists.whatever;
void notexists;
notexists();
No:
notexists = exists;
var notexists = notexists;
typeof notexists;
delete notexists;
Question
Given a global variable exists
that is defined and a variable notexists
, what is an exhaustive list of where ReferenceError
s get thrown and don't get thrown? So far I have yes for:
notexists;
notexists++;
Also curious about special cases where they aren't thrown, e.g.:
var notexists = notexists; //equivalent to: var notexists; notexists = notexists;
typeof notexists; //special case?
Did I miss anything else?
Rationale: I'm writing a static analyzer and I have to cover all these cases perfectly.
Solution
Editing this answer to make the exhaustive list.
Yes:
notexists;
notexists++;
notexists.whatever;
void notexists;
notexists();
No:
notexists = exists;
var notexists = notexists;
typeof notexists;
delete notexists;