How to Get the Browser Viewport Dimensions
There are two sets of properties that help you get the height and width of the viewport dimensions: innerWidth and innerHeight, and clientWidth and clientHeight.
The getWindowDims function returns an object which contains the width and height properties:
The innerWidth and innerHeight are the properties of the window object, the clientWidth and clientHeight properties are obtained for the body or documentElement property of the document object. The innerWidth and innerHeight properties contain the width and height of vertical and horizontal scrollbars. The clientWidth and clientHeight properties provide dimensions inside scrollbars. If the viewer uses a mobile device, the clientWidth and clientHeight properties would be preferable as it gives the size of the visual viewport on a mobile device.