Skip to main content

withJS Keyword to extend Scope Chain of Statement . !Forbidden in Strict Mode!

syntax

const myColor = {color: "red"}
with (myColor){
console.log(color)
}

with (param) selects the default object in scope

with violates Lexical Scope which affects "security analysis" somehow??

with deprecated - MIGHT add slight code perf but potentially buggy & forbidden in strict mode!

References