Are you first timer at Why not join us and start exchange your programming knowledge with everyone. Register today!

JSON - Accessing a numeric property

0 votes
added Jul 4, 2018 in API by LC Marshal Captain (26,080 points)
edited Jul 13, 2018 by LC Marshal
var myObject = { '0' : 'blue', 'satu' : 'red' };

//Usually, to access the property with:
myObject.0 //this is usually not working
myObject.satu //this is ok, because its not numeric

//use this instead
(myObject["0"] is an alternative syntax for myObject.0.

Please log in or register to response this reference. - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.