JavaScript Window screenY Tutorial

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

JavaScript Window screenY Property

The `screenY` property returns the distance between the top edge of a browser window and the top side of the display screen.

The return value of this property is pixel based. So if the value is 100, that means the distance is 100 pixels.

Note: if we maximize a browser window, the returned value of this property becomes 0! Because in that case, there won’t be a distance between the two edges.

Window screenY Property Syntax:

window.screenY;

Example: using JavaScript Window screenY Property

console.log(window.screenY)

Output:

Depending on the current position of the browser window, the value of this property varies.

Leave a Reply