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 (2015) Constructor Functions and Prototypes Playlist Project

How do I know I need song and playlist object ? And what properties and method do I need?

Every time I think about a problem I will start from the UI interface , for example , in this project , I think , I want to click the play button ,so the button need a event handler , and I am thinking what the event will be , but I don't know what object do I need , what properties and methods should be in the object.

So how to analyse the problem ? Thanks

2 Answers

I am right there with you, but I will attempt an answer for you. from my understanding it may be helpful to think of objects in javascript like containers and the methods are the ability to interact with the contents of said container. If you have a song, you may be able to surmise that you need a container to hold that song, and a method in which to interact with that song that is in your container. At least this is my understanding of this subject so far. So it may be helpful to think of objects like physical objects that you need to put in a container to store and the methods are control knobs and dials that allow you to access your physical object without having to take it out of safe storage Let me know if this helps and let's continue this conversation so that we can ruminate over this subject more so we can get a firm grasp.

.onClick