CHANNELS:

All
S
Swebd posted 3 years ago
chris posted 3 years ago

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 innerWidth and innerHeight are window properties, so I don't really include it in most of my projects unless I absolutely have to.

0
S
Swebd posted 3 years ago

I understand! Thanks for the quick explanation and keep it up!

1
d
dbaxi posted 3 years ago

0

Want to participate?

Create a free Chris Courses account to begin

or
Sign In

Providing the lift to launch your development career

© 2022 Chris Courses. All rights reserved.