typeof
allows the identifier to never have been declared before.
So it’s safer in that regard:
if (typeof neverDeclared === "undefined");
//no errors
if (neverDeclared === null);
//throws ReferenceError: neverDeclared is not defined
typeof
allows the identifier to never have been declared before.
So it’s safer in that regard:
if (typeof neverDeclared === "undefined");
//no errors
if (neverDeclared === null);
//throws ReferenceError: neverDeclared is not defined