Last updated 2 years ago
JS ⟩ scope ⟩ global ⟩ variable ⟩ let ⟩ shadows global object property
global let shadows global object property
replit:global let shadows global object property
// in "browser" environment, globalThis === window const { log } = console; // ⭐️ "global let" shadows "global object property" globalThis.prop = 42; // global object property let prop = 'hi'; // global let log(prop); // 'hi' // shadows global object property log(globalThis.prop); // 42 // global object property remains untouched
YDKJS: Scope & Closures (v.2) ⟩ Ch. 4: