GeeksforGeeks

How do I get the coordinates of a mouse click on a canvas element?

Click anywhere on the canvas element to get the mouse pointer location.

The size of the canvas is a square of 200px.

Check the console for the output.