Hi World,
I´ve just passed the challenge called ** Accessing Object Properties with Variables** using this code:
// Setup
var testObj = {
12: "Namath",
16: "Montana",
19: "Unitas"
};
// Only change code below this line
var playerNumber = "Montana";
var playerNumber = 16; // Change this line
var player = testObj[playerNumber]; // Change this line
How it is possible if I´ve declare two times and with different values the variable playerName?. It worked only with:
var player = testObj[16];
but I must use [playerNumber]
variable.
Could you help me to understand this point?
Thanks.