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

Not to be pedantic... but eq(4) isn't the last element... shouldn't it be the 5th element (which happens to be last)?

I think that it should have been stated in the video that directly choosing an element like that isn't really good practice as you often can't guarantee it will be the last one. Also, that goes the same with using $('li span') to grab the span you just created. It will grab ALL spans inside li elements, which may not be the desired behaviour.

Can you post a link to the video?

1 Answer

Steven Parker
Steven Parker
231,172 Points

But eq(4) would be the 5th element, since the eq(0) is the first element (index values start at 0).