Question: how to create global variable that initially holds an empty array. This array will be a 2d array that will store arrays of [x,y] coordinates.
how to create global variable that initially holds an empty array. This array will be a 2d array that will store arrays of [x,y] coordinates.
Then, how tocreate an onclick event handler on the canvas so that every time the canvas is clicked the following things happen: Get the x and y coordinate of the click that just occurred (hint: offsetX and offsetY) Create an array that contains the [x,y] coordinate and push it into the global array Then draw and fill a circle of radius 10 centered at this (x,y) coordinate Upon completing this step, when you click on the canvas three times your canvas should look like:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
