Basic JavaScript: Testing Objects for Properties

Basic JavaScript: Testing Objects for Properties
0

#1

Tell us what’s happening:

Your code so far


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

// Only change code below this line;

var playerNumbers = 16;       // Change this Line
var playerNumber = testObj[playerNumbers];
console.log(playerNumber);

var player = testObj;   // Change this Line

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-javascript/accessing-object-properties-with-variables


#2

You added an extra line that’s un necessary. Only modify lines where it says change this line. Also you have modified variables names as well.

Go head and reset your code. You did the first line right except you made the varaible name plural.

Then use the 2nd line again with correct variable name in bracket (playerNumber) and save it in the player variable.


#3

Thank you i really appreciate