const { log } = console;constisCurrentlyInGlobalScope= () =>this=== globalThis;// log( prop ); // ReferenceError: (property is not hoisted) ⛔ log( topLevelVar ); // undefined : (var is hoisted but uninitialized)// ⭐️ a global object property is like a global var (but not hoisted)globalThis.prop =42; // // define new propertylog(prop,typeof prop); // 42, number // it acts like a global varprop =36; // // we can change itconsole.log(globalThis.prop); // 36 // change will reflect on global object// ⭐️ a global var is a global object property// ❗ but in Node.js:// • top-level scope is NOT global scope// • top-level var will NOT be reflected in global/module context.var topLevelVar ='hello';log(globalThis.topLevelVar); // undefined❗log(module.exports.topLevelVar); // undefined❗// log;[ globalThis === global,// true// current contextisCurrentlyInGlobalScope(),// falsethis===module.exports,// true].forEach(x =>console.log(x));