I have a javascript object array:
array = [ {x1, y1}, {x2, y2}, ... {xn, yn} ]
I want to create a new array of just the x
values:
[ x1, x2, ... xn ]
I could do this easily in a for
loop...:
var newarray = [];
for (var i = 0; i < array.length; i++){
newarray.push(array[i].x);
}
...but I'm wondering if there's a nice one liner way to do this using jquery or even regular javascript?