For asynchronous functions, you need to provide a callback function, not expect a return value. You must call the "codeAddress" function as follows:
var entry = zips[i];
var citymapForZip = {
scans: entry['num_scans'],
};
var zipCode = entry['zip_code'];
citymap[zipCode] = citymapForZip;
codeAddress(zipCode, getCallbackFunction(citymapForZip));
"getCallbackFunction", . "position" . :
function getCallbackFunction(citymap) {
return function(result) {
citymap.position: result;
};
}
, , codeAddress , "latlng", :
function codeAddress(zipCode, callback) {
geocoder.geocode( { 'address': zipCode}, function(results, status) {
var lat = results[0].geometry.location.d;
var lng = results[0].geometry.location.e;
var latlng = lat+'XX'+lng;
callback(latlng);
});
}