I am calling an api which returns an object
var rain = data[i].rain;
$.get( "http://api.openweathermap.org/data/2.5/forecast?q=London,uk&mode=json&units=metric", function( data ) {
var data = data.list;
for(var i = 0; i < 12; i++){
var rain = data[i].rain;
console.log(rain)
}
});
rain returns the following when I inspect the console:
Object {3h: 0.005}
Object {3h: 0.03}
I expected that rain.3h
would have given me access to 0.005 and 0.03, but it doesn't. I get the following error message : Unexpected token ILLEGAL
Is this because it begins with a number? Can anyone advise how to access this property?