Forum Moderators: open

Message Too Old, No Replies

Screen.width, screen.width, or window.screen.width?

         

csdude55

6:43 pm on Sep 11, 2023 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've been using screen.width for about a decade, but just recently discovered that ESLint throws an error on it. It says to use Screen.width (capital-S).

That led me here:

[developer.mozilla.org...]

This page is a little confusing. It starts out by talking about Screen.width, then the examples all use window.screen.width.

I plugged in window.screen.width, and ESLint is OK with it.

I'm gonna guess that either window.screen.width or Screen.width is "official", and the others are aliases. Which, in theory, means that if I'm using an alias then it would be a fraction of a second slower (while translating itself).

Any thoughts on which one is the right one to use?