I have the following code:
var newLat = markerElem.getAttribute('lat');
var newLng = markerElem.getAttribute('lng');
var locations = [
{lat: newLat, lng: newLng}
]
I want to get the values of the variables newLat
and newLng
and store them within the locations
array as values of their respective indexes.
EXAMPLE
I want the values of the variables newLat
and newLng
to be passed to the indexes of array lat
and lng
, thus:
var newLat = 123;
var newLng = 321;
var locations = [
{lat: 123, lng: 321}
]