🛡️strict mode
🚧 施工中
Last updated
🚧 施工中
Last updated
JS ⟩ concepts ⟩ environment ⟩ JS engine ⟩ mode ⟩ strict
always use strict mode ( see why)
a way to opt in to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode".
in strict mode:
function in block (FiB) is local to the block.
referencing a function in block (FiB) outside the block:
sloppy mode: ✅ hoisted / initialized to undefined (in outer scope)
strict mode: ⛔ ReferenceError (invisible in outer scope)
class / ES module always works in strict mode❗️