freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/accessing-object-properties.../index.md

22 lines
388 B
Markdown
Raw Normal View History

2018-10-12 19:37:13 +00:00
---
title: Accessing Object Properties with Variables
---
## Accessing Object Properties with Variables
Here's a working solution in case you are stuck:
```js
// 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
```