JavaScript Window self Tutorial

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

JavaScript Window self Property

The `self` property always points to the window object that invoked the property. The two can, in fact, be used interchangeably. Even though it has no separate value, `self` is included for consistency with the `top` and `parent` objects.

Note: this property is read-only.

Window self Property Syntax:

window.self

Example: using Window self property in JavaScript

See the Pen using Window self property in JavaScript by Omid Dehghan (@odchan1) on CodePen.

Output: Yes, they are the same.

Leave a Reply