Skip to main content
InterviewHubPRO
Section Overview
Q177

Question 177 of 536

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

33%
JavaScript & V8 Internals (536 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

What are the properties used to get size of window

junior LevelMost AskedCode ExampleEvent LoopPrototypes

You can use innerWidth, innerHeight, clientWidth, clientHeight properties of windows, document element and document body objects to find the size of a window. Let's use a combination of these properties to calculate the size of a window or document,

javascript
  var width =
    window.innerWidth ||
    document.documentElement.clientWidth ||
    document.body.clientWidth;

  var height =
    window.innerHeight ||
    document.documentElement.clientHeight ||
    document.body.clientHeight;