- Window is the browser window
alert('hello')
is the same as window.alert('hello')
- When we refer to variable or function, it looks in the local scope first. If it is not found there, it moves up the chain until it reaches the Window object, at which point it is global
- All global variables are part of the Window object. They can be referenced as
window.foo
- You can overwrite global (Window object) functions by redeclaring them with the same name
- Window object is in the global namespace
let greeting = 'Bonjour!'
window.alert(window.greeting)
Links