Example 1 — Log screenY on Move
MDN-style: update a log whenever the pointer moves.
const log = document.getElementById("screen-log");
document.addEventListener("mousemove", (e) => {
log.textContent = `screenY: ${e.screenY}`;
}); How It Works
- Listen for
mousemove. Fires as the pointer moves. - Read
screenY. Vertical px from the screen top. - Show it live. Useful for demos and debugging.
- Value type. A
doublein modern engines (MDN).

