Example 1 — Basic Read
Beginner example for window.innerHeight.
console.log(typeof window.innerHeight);
console.log(window.innerHeight > 0); How It Works
- Step. A positive number for a visible window.

window.innerHeight is the viewport height in CSS pixels.
Read window.innerHeight with no parentheses.
window.innerHeight; | Call | What it does |
|---|---|
window.innerHeight | Viewport height in CSS pixels. |
Window property in browsers. No import required.
| Parameter | Description |
|---|---|
| window.innerHeight | Read-only or assignable depending on the property. No function arguments. |
| Return Value | Description |
|---|---|
| * | Viewport height in CSS pixels. |
Beginner example for window.innerHeight.
console.log(typeof window.innerHeight);
console.log(window.innerHeight > 0); Beginner example for window.innerHeight.
console.log(window.innerWidth + " x " + window.innerHeight); Beginner example for window.innerHeight.
const short = window.innerHeight < 500;
console.log(short); window.innerHeight is a standard Window property in browsers.
Available in all modern browsers. Not used in plain Node.js without a DOM.
Bottom line: Safe in browsers. Skip in server-only Node scripts.
Continue through the Window properties list.
CODETOFUN NEWS
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
9 people found this page helpful