Thank you Akshay Saini for this beautiful series. Just summarizing your lessons for whenever I need a quick recap. Same for others. Hope it helps.
window is a global object which is created alongside with Global execution context.
So, even if you don't write any code , Js automatically provides us with a global object named window which contains many methods.
Any code which is not written inside a function lies in global space.