JavaScript Window innerHeight Tutorial

In this section, we will learn what Window innerHeight property is and how to use it in JavaScript.

JavaScript Window innerHeight Property

The `innerHeight` is a read only property that returns the height of the visual view-port, which is the visible area of the page on the screen. (The content area)

Note: the value of the `innerHeight` property changes if we zoom in or out of a page.

Also, this property is read-only.

Window innerHeight Property Syntax:

window.innerHeight

Example: JavaScript height of window

console.log(window.innerHeight);

Output:

As we change the size of the browser, the value of the `innerHeight` will change as well

Example: get window size JavaScript

console.log(window.innerHeight);

console.log(window.innerWidth);

Leave a Reply