Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
212,246 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
212,246 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".