It shows 6 as JavaScript uses arrays whose index starts at 0 (as do many other C-based languages).
The extra “>” is a CSS selector that says “Only select the next element if it is a direct child” … in this case it’s saying “only select li#end if it is a direct child of ul”. Additionally in this example the immediate-child operator is superfluous as the <li> in question has an ID and <li>'s always need to be a direct child of a <ul>. In fact, in this example, because your <li> has an ID, you could even leave the "ul " part of the selector off completely.
The difference between [I].length[/I] and [URL=“http://api.jquery.com/index/”][I].index()[/I] is that .length is a native JavaScript property of Arrays. It will return the length of the array. So when you did your initial selection of $(“ul li#end”) jQuery was only returning one element, and thus the length property was 1.
.index() is a jQuery method that will return the index of an element relative to its sibling elements