❗sloppy mode
Last updated
Last updated
JS ⟩ concepts ⟩ environment ⟩ JS engine ⟩ mode ⟩ sloppy
synonyms: "non-strict mode", "sloppy mode"
compare: strict mode
in sloppy mode:
although scopes are determined at compile-time, you can modify the scope at runtime ( 👉 modify current scope at runtime❗️)
function in block (FiB) is hoisted / initialized to undefined (outside the block)
assignment (=) to undeclared identifier will result in accidental global variable in sloppy mode❗️
with a function in block (FiB)
sloppy mode: ✅ hoisted / initialized to undefined (in outer scope)
strict mode: ⛔ ReferenceError (invisible in outer scope)