Javascript Global Object – window

window object: The window object represents a window containing a DOM document

Properties:

  1. window.document:  returns a reference to the document contained in the window.

Example:

HTML Snippet:

<head>

<title>Hello, World!</title>

</head>

JS Snippet:

var doc = window.document;
console.log(doc.title); // Hello, World!

2. window.screen: The screen object contains information about the visitor’s screen.

Example:

var screen = window.screen;

console.log(screen.width);