❗undeclared identifier
JS ⟩ identifier ⟩ undeclared
assignment (=) to an undeclared identifier in sloppy mode will result in an accidental global variable in sloppy mode❗️
👉 related:class body has its own "this" context
typeof undeclared === "undefined" // trueassignment (=) to undeclared identifier will result in
there is NO way to write a function to check if an identifer is declared.
// assume f is such a function
f(undeclared) // ⛔ ReferenceError
// JS will throw a ReferenceError on accessing `undeclared`
// BEFORE you even have a chance to call f()❗Last updated
Was this helpful?