In ECMAScript 5 and below, var declarations at the top level of a script become globals, which is to say, properties of the global object (window in browsers.) In ECMAScript 6, we now have modules. Modules are in strict mode, so we won't automatically create a global by forgetting var, but if I declare a var at the top level of a module, does it become a global property of the window object? What if I use let or const or any of the new declaration forms added in ES6?
var foo = {};
console.log(window.foo === foo); // true or false?
let bar = {};
console.log(window.bar === bar); // what about this?
 
     
    