Quiz Entry - updated: 2026.07.05
What is the window object and what does it contain?
window is the browser's global object holding the DOM (document), the BOM (location, navigator, history), storage, timers, and every global variable.
Structure:
window
├── document (DOM - page content)
├── navigator (browser info)
├── location (URL info)
├── history (browsing history)
├── screen (display info)
├── localStorage/sessionStorage
└── (all global variables and functions)
Key properties:
// Viewport width
window.innerWidth
// Viewport height
window.innerHeight
// Current URL
window.location.href
// Browser info
window.navigator.userAgent
Global scope:
var x = 5;
// 5 (var creates window property)
console.log(window.x);
let y = 10;
// undefined (let doesn't)
console.log(window.y);
Note: window is implicit - alert() is shorthand for window.alert().
Go deeper:
Window interface (MDN) — the browser's global object:
document,navigator,location,localStorage, timers and more.