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 Object-Oriented JavaScript Getters and Setters Object Interaction

yoav green
yoav green
8,611 Points

how come ernie.owner in now an object?

how come ernie.owner in now an object?,

2 Answers

Steven Parker
Steven Parker
231,264 Points

The whole point of this particular video is to create the "Owner" object, to store information about an owner, and then to reference the owner's object from each pet ("ernie" in this case). So instead of just a name, you can now get the full information about the owner.

yoav green
yoav green
8,611 Points

thanks. in addition, was the get function was needed assuming we did not need the .replace method?

Steven Parker
Steven Parker
231,264 Points

If you did not need to modify the phone value, you could omit both the "get" and "set" functions and just call the variable "phone".