JavaScript Window screenX Tutorial

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

JavaScript Window screenX Property

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

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

Note: if we maximize a browser window, the returned value of this property becomes 0! Because now there’s no distance between both edges.

Window screenX Property Syntax:

window.screenX

Example: using JavaScript Window screenX Property

console.log(window.screenX)

Output:

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

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies