How to access event.clientX outside of window function?

Viewed 14

I tried to use the event.clientX outside of window function. But it says xAxis is not defined. Can have an way to get it? My code below,

window.onclick = function(event) {
        let xAxis = event.clientX;
}
alert(xAxis);
0 Answers
Related