I think I figured it out after I posted the question. I found it in the jQuery API documentation. If I was working with a string, then
.length would be just a number representing the number of characters, but in this case it's a jQuery object. For example
$('.active-slide').next() would match the next sibling of the active slide and
.length on a jQuery object returns the number of elements matched. If it's the last slide, that matches 0 elements.