Hi so i got this array:
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1]
];
and i want to append to it just like it is example:
var locations = [
['Bondi Beach', -33.890542, 151.274856, 4],
['Coogee Beach', -33.923036, 151.259052, 5],
['Cronulla Beach', -34.028249, 151.157507, 3],
['Manly Beach', -33.80010128657071, 151.28747820854187, 2],
['Maroubra Beach', -33.950198, 151.259302, 1],
['New item', -22.950198, 141.259302, 6]
];
I have no idea how to do it, search 'Add items to array in array ' didn't quite seem to work out.
locations.push(['New item', -22.950198, 141.259302, 6]);pushany item it just so happens this item is an array. But if you wanted to add items to an array inside an array you would locate the array to add to andpushas well. So would be like:locations[1].push(whatever). This would push whatever to the end of the 'Coogee Beach' array.