Basic JavaScript - Accessing Object Properties with Variables

Tell us what’s happening:

Was the Object suppose to update?

Your code so far

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

// Only change code below this line
const playerNumber = 16;  // Change this line
const player = testObj[playerNumber];   // 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/106.0.0.0 Safari/537.36

Challenge: Basic JavaScript - Accessing Object Properties with Variables

Link to the challenge:

I dont see the problem here, its going to update as instructed.

what is going to update?

nothing is being updated. u’re assining to the variable player the string “Montana”

1 Like

Player is going to have the value “Montana”, now you can use player in terms of “Montana”

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.