Skip to content
Advertisement

Tag: window-object

Why do we write window.?

While adding some initialisation code to a webpage, I found myself writing window.onload = … for the umptieth time, when a thought hit me. The window. isn’t necessary, because window is the current object. So it’s optional! But nobody writes just onload = … and I wonder why that is. I mean, we have no qualms about writing other things,

Advertisement