Unsure of how to pass the returned value of getLocationsArray
outside of the getLocations method. How would this be done so setMarkers
method can use it? Of course, im aware when calling methods or vars internally within an object literal i can use APP.map.setMarkers
for example. Thanks.
init: function(){
...ETC...
APP.map.getLocations()
APP.map.setMarkers(center, radius, map)
},
getLocations: function() {
$.getJSON('data/json/locations.json', function(data) {
var locations = data
var getLocationsArray = $.map(locations, function(value, index) {
return [value]
})
console.log(getLocationsArray)
return getLocationsArray
})
console.log('getLocationsArray2', getLocationsArray2)
return getLocationsArray2
},
setMarkers: function(center, radius, map) {
**getLocationsArray**.forEach (function (hello) {
..ETC..
}