lundi 3 mars 2014

Trouble with Javascript object properties - Eloquent Javascript example


Vote count:

0





var thing = {"gabba gabba": "hey", "5": 10};
show(thing["5"]);
thing["5"] = 20;
show(thing[2 + 3]); // = 20
show(thing[2]); // = undefined
show(thing[3]); // = undefined


I do not understand why show(thing[2+3]) = 20 and the other two below it return undefined. What does the 2 and 3 refer to? Could someone help me out with this. Thanks!



asked 19 secs ago






Aucun commentaire:

Enregistrer un commentaire