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
Pawel Sysiak
232 PointsWhy do we need to pass a parameter (li) to the function when creating buttons?
Why do we need to pass a parameter (li) to the function when creating buttons?
1 Answer
Steven Parker
243,266 PointsYou didn't leave a link to the course you're working with, but if I remember correctly the function you are talking about is designed to add buttons to an existing list item element. The argument "li" is a reference to the particular list item that is passed to the function so it can append the buttons it creates to the correct element.
If you are wondering why the function isn't just designed to add buttons to every list item in the document, that's probably to make it useful in cases where the document has more than one list, but only one needs buttons added.