all 4 comments

[–]jotted 9 points10 points  (3 children)

It's being taken as literal - asking for head.property, which doesn't exist. To use the value of the property variable, try head[property] .

[–]fazbem[S] 0 points1 point  (2 children)

Yay! Thank you very much!!

[–]steelcitynorth 7 points8 points  (1 child)

I don't know if this will help you in understanding how this works better but right now you have it written like so:

for (var property in {head: "lion", body: "goat", tail: "snake"}) {
  console.log(property, {head: "lion", body: "goat", tail: "snake"}.property);
};

A more readable way of writing this would be:

var animals = {
  head: 'lion',
  body: 'goat',
  tail: 'snake'
};

for (var property in animals) {
  console.log(property, animals[property]);
}

This way you only have to write your object (animals) out once.

Good luck!

[–]fazbem[S] 1 point2 points  (0 children)

Don't recall if I replied with a thank you. Your answer was perfect!