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 Objects Object Basics Access and Set Object Properties

Can someone tell me why this code doesn't pass, it's correct based off my notes?

script.js
const addy = {
  animal: 'dog', 
  age: 3,
  breed: 'pug'
};
const message = `Hi my pug is ${addy.age + 1}.`

2 Answers

Steven Parker
Steven Parker
231,261 Points

This will create a message string indicating a higher age, but the instructions ask you to change the property itself (and no string is needed). You want something more like this:

addy.age += 1;

Ok that makes more sense thanks Steven.