๐ก๏ธstrict mode
๐ง ๆฝๅทฅไธญ
Last updated
Was this helpful?
๐ง ๆฝๅทฅไธญ
Last updated
Was this helpful?
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โ๏ธ