How to access event.clientX outside of window function?

47 Views Asked by At

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

There are 0 best solutions below