Hey Swebd, great question!
So, the reason I use
innerWidth sometimes instead of
window.innerWidth is that by default, you can access any
window property within a JS file as long as it's being read by the browser.
You technically don't need
window at all, as long as you know the property name associated with the window object, you can take out the
window portion altogether.
The main reason you'd want to keep that
window. prefix is for clarity purposes. In my case, I already know
innerHeight are window properties, so I don't really include it in most of my projects unless I absolutely have to.
Want to participate?
Create a free Chris Courses account to begin