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 (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