Why is this NaN to javascript?

Posted by MJB on Stack Overflow See other posts from Stack Overflow or by MJB
Published on 2012-10-01T21:35:03Z Indexed on 2012/10/01 21:37 UTC
Read the original article Hit count: 126

Filed under:

I have this object printed with console.log

Array[1]
    0: Object
       address: "blablabalbala"
       datatype: "Location"
       icon: "cafetaria"
       id: "/mensa/wo_mensa1_turm.std.php"
       kind: "Mensa"
       lat: 50.777016
       lon: 6.080348
       sortkey: "zeltmensa, forum cafete"
       stationId: "/mensa/wo_mensa1_turm.std.php"
       title: "Zeltmensa, Forum Cafete"
       type: "Mensa"

But console.log("nav to: "+data[0].lat+" "+data[0].lon); gives me undefined undefined, and at another point NaN NaN.. I don't understand this. It also doesn't let me use any other attributes like data[0].addresse, which returns undefined aswell.

Thanks for help.

© Stack Overflow or respective owner

Related posts about JavaScript