# Accessing Nested Objects before the Holiday

**URL:** <https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982>\
**Category:** General\
**Created:** [December 22, 2017, 7:54pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982 "2017-12-22T19:54:49Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![frontManProg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/frontmanprog/32/69750_2.png) [@frontManProg](https://forum.freecodecamp.org/u/frontManProg)\
**Post date:** [December 22, 2017, 7:54pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/1 "2017-12-22T19:54:49Z")

</div>

**Tell us what’s happening:**

I am outputting the correct answer “maps”. however the dot/bracket notation is not accurate. I have looked at the example and can not see the mistake I have made. Any ideas?

**Your code so far**

```auto
// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove_box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

// Only change code below this line

var gloveBoxContents = myStorage.car["inside"].glove_box; // Change this line

```

**Your browser information:**

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

**Link to the challenge:**  
[https://www.freecodecamp.org/challenges/accessing-nested-objects](https://www.freecodecamp.org/challenges/accessing-nested-objects)

---

<div class="post-metadata">

**Author:** ![iamknox](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/iamknox/32/70853_2.png) [@iamknox](https://forum.freecodecamp.org/u/iamknox)\
**Post date:** [December 22, 2017, 7:57pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/2 "2017-12-22T19:57:30Z")

</div>

What do you mean by the dot/bracket notation is not accurate? You’re saying you’re getting the correct answer but not passing the test?

---

<div class="post-metadata">

**Author:** ![ArielLeslie](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/arielleslie/32/264841_2.png) [@ArielLeslie](https://forum.freecodecamp.org/u/ArielLeslie)\
**Post date:** [December 22, 2017, 8:13pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/3 "2017-12-22T20:13:30Z")

</div>

You should not have changed the property `"glove box"` to `"glove_box"`. Change only the line that says “Change this line”.

---

<div class="post-metadata">

**Author:** ![frontManProg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/frontmanprog/32/69750_2.png) [@frontManProg](https://forum.freecodecamp.org/u/frontManProg)\
**Post date:** [December 23, 2017, 5:50am UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/4 "2017-12-23T05:50:12Z")

</div>

yes thats correct . Iam not passing the Dot/Bracket notation part.  
I do get the correct output though.  
any idea why?

---

<div class="post-metadata">

**Author:** ![iamknox](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/iamknox/32/70853_2.png) [@iamknox](https://forum.freecodecamp.org/u/iamknox)\
**Post date:** [December 23, 2017, 6:57am UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/5 "2017-12-23T06:57:50Z")

</div>

Did you try changing the code above the line back to what it was originally like @ArielLeslie suggested?

---

<div class="post-metadata">

**Author:** ![frontManProg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/frontmanprog/32/69750_2.png) [@frontManProg](https://forum.freecodecamp.org/u/frontManProg)\
**Post date:** [December 23, 2017, 8:05am UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/6 "2017-12-23T08:05:36Z")

</div>

not sure why it works this way. But correct output happens when I add \_ to glove box, at the top, as well as bottom. Otherwise it does not work.

The second problem is: var gloveBoxContents = myStorage.car[“inside”].glove\_box;  
This should be correct as I see it. If you see something worth changing let me know. Maybe its a bug.

var myStorage = {  
“car”: {  
“inside”: {  
“glove\_box”: “maps”,  
“passenger seat”: “crumbs”  
},  
“outside”: {  
“trunk”: “jack”  
}  
}  
};

// Only change code below this line

var gloveBoxContents = myStorage.car[“inside”].glove\_box;

---

<div class="post-metadata">

**Author:** ![iamknox](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/iamknox/32/70853_2.png) [@iamknox](https://forum.freecodecamp.org/u/iamknox)\
**Post date:** [December 23, 2017, 6:49pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/7 "2017-12-23T18:49:36Z")

</div>

![image](https://global.discourse-cdn.com/freecodecamp/original/3X/0/c/0c5a5af1bf9589d7b6ae0d4d13f47a5e44b366f1.png)

The directions say to access `glove box` not `glove_box`

![image](https://global.discourse-cdn.com/freecodecamp/original/3X/6/b/6b947dd6a11bd3008b1067ee128fd24cd6ee55d0.png)

These directions specifically tell you not to change above the line. If I had to guess why you aren’t passing the challenge it’s because you didn’t follow the directions. You get the right answer because you are accessing `glove_box` which now exist because you have changed the initial object you were given.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/7/3/7384aa263e7631ac9c9c9da4f6303a446a56515b.png)

As you can see your code gets a warning. If you check the warning it’s the biggest clue as to what you’re missing from this challenge.

The point of bracket notation is that it is there to use when you need to reference a variable `[myVar]` (notice no quotes), or when you need to reference a property that has a blank space in the name such as `['glove box']`, notice the quotes that time.

As the warning says it doesn’t really make sense to put `inside` within brackets, So you get the answer you want because your code is valid JavaScript however you don’t follow the directions about not changing what you aren’t supposed to change.

I would suggest trying to solve it before looking at this but it’s supposed to be implemented like this:

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/8/1/810ba623438d1b3514c08e0dbb8e3fed9766c84f.png)

---

<div class="post-metadata">

**Author:** ![frontManProg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/frontmanprog/32/69750_2.png) [@frontManProg](https://forum.freecodecamp.org/u/frontManProg)\
**Post date:** [December 23, 2017, 7:08pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/8 "2017-12-23T19:08:13Z")

</div>

Hey Thanks so much for the explanation. Made the changes and passed.

---

<div class="post-metadata">

**Author:** ![iamknox](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/iamknox/32/70853_2.png) [@iamknox](https://forum.freecodecamp.org/u/iamknox)\
**Post date:** [December 23, 2017, 7:15pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/9 "2017-12-23T19:15:37Z")

</div>

Anytime good luck with the rest of your journey!

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 16, 2021, 5:13pm UTC](https://forum.freecodecamp.org/t/accessing-nested-objects-before-the-holiday/164982/10 "2021-01-16T17:13:43Z")

</div>

Closed on January 16, 2021, 5:13pm UTC


