I wonder how to create an object inside the foreach? Without posting here all my code, in my case, I cannot declare the object outside of the foreach (using react and doing that insight my render function which leads to weird results). How can I do that? Thanks!
var list;
this.state.resp.forEach(function(e) {
list[e.OriginLocation.AirportCode] = e.OriginLocation.CityName;
});