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
Constructor and prototype for new list item?
Hello - would a more favorable way to code a new list item be by creating a constructor with some basic properties (like maybe a title or label), then creating a listItem.prototype to handle all the functions? New coder here, just trying to connect some dots!
Hey Jason Gresalfi,
I'm sure you've heard a similar variation of the following quote: "There are many different ways to skin an apple." Well, just as that saying applies to that most awesome of fruits, so does it apply to coding. There are many different ways to code a program. But, first, are you just trying to create some new list items and then append them to an unordered/ordered list?
Apples are indeed awesome - including the over-priced but very delicious Honey Crisp. And yeah, I'm actually referring to the To-Do list project in Andrew Chalksley's Interactive Web Pages video. He wires up a bunch of functions to make actions and I guess a better way to ask my questions would have been more specific, like why did he choose NOT to use a constructor? My guess is because the to-do item itself isn't very complex so there's no need for an elaborate prototype to add all sort of things to the form. As you say, there are a lot of ways to to things and I guess I'll get a better idea with more experience. Thanks!