Advertisement
728x90
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 them combination of these properties to calculate the size of a window or document,
javascript
1var width =
2 window.innerWidth ||
3 document.documentElement.clientWidth ||
4 document.body.clientWidth;
5
6var height =
7 window.innerHeight ||
8 document.documentElement.clientHeight ||
9 document.body.clientHeight;Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 2
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
173of476