Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Loops, Arrays and Objects Tracking Data Using Objects Review Object Basics

Yacine Freifer
Yacine Freifer
6,717 Points

This question seems wrong. Change the attribute of an object variable.

I think the correct answer would be animal.weight=800; However, it appears the quiz has not given any of the correct answers. Unless C is a trick answer.

1 Answer

Hi Yacine

You are correct animal.weight would be correct too, there are multiple ways of changing an object literals property value.

dot notation syntax

This is the one you are referring to

animal.weight = 800;

square breaket syntax

This is what the question provides as a possible answer

animal['weight'] = 800;

Hope this helps