I want to store coordinates into an array in javascript, I am new to javascript and do not have an idea how to do it.
Any help would be appreciated.
The push method would do the job:
var arr = new Array(); arr.push({ x : x_coordinate, y : y_coordinate });
var arr = new Array();
arr.push({ x : x_coordinate, y : y_coordinate });
You can then access them by using
arr[0].x (gives the x coordinate)
arr[0].x
and
arr[0].y (gives the y coordinate).
arr[0].y
Hope it helps.