Accessing Objects Properties with Variables HELP

Accessing Objects Properties with Variables HELP
0.0 0

#1

Tell us what’s happening:

Code is is giving me the players name for number 16 but it still wont let me pass??

Your code so far

// Setup
var testObj = {
  12: "Namath",
  16: "Montana",
  19: "Unitas"
};

// Only change code below this line;

var playerNumber = [16];       // Change this Line
var player = testObj[playerNumber];   // Change this Line

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0.

Link to the challenge:


#2

The above assigns the variable playerNumber an array with one element (the value 16). Instead, you just need to assign the variable playerNumber the value 16.


#3

Thank you, I cannot believe that it was something so simple holding me back, I suppose im finding out the longer you look at code the harder it becomes to see the flaws. Thank you again.