Example 1 — Read availHeight
Log the available screen height in CSS pixels.
console.log(window.screen.availHeight);
console.log(typeof screen.availHeight); How It Works
- Access
window.screen. Every window exposes aScreenobject. - Read
availHeight. MDN: height in CSS pixels available for web content. - Check
typeof. It is always a number in browsers that support Screen. - Do not write to it. The property is read-only.

