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 trialJennelle Barajas
5,317 PointsWhat does Andrew mean by "cycle over"?
When we get to the part where we
//cycle over incompleteTasksHolder ul list items
What does he mean by cycle over
?
I am not sure what exactly we are trying to accomplish by writing this function.
Are we writing a function that will jump from ul
to li
?
If so, why?
Here is the completed mark-up by the end of this lesson:
//cycle over incompleteTasksHolder ul list items
for(var i = 0; i < incompleteTasksHolder.children.length; i++); {
//bind events to list item's children (taskCompleted)
bindTaskEvents(incompleteTasksHolder.children[i], taskCompleted);
}
I am generally confused with this lesson.
Thank you in advance!
-Jennelle
2 Answers
Hugo Paz
15,622 PointsHi Jennelle,
It means cycling through all list elements that are in the incompleteTasksHolder unordered list.
Imagine having a list with 5 items, you cycle through each one to check their status.
Judd Higgins
8,846 PointsJennelle, you are not alone. This is probably the most confusing lesson thus far of my Front End Web Development track.
Eric Trego
15,308 PointsEric Trego
15,308 PointsHugo what is the difference between using
///////// for( var i = 0; i < .length; i++) /////////
and using /////// for (var i= 0; i < .length; i + 1) ////////
Hugo Paz
15,622 PointsHugo Paz
15,622 PointsHi Eric,
I believe you meant i+=1. If you use i + 1, i never changes so the condition is never met and you have an infinite number.
There is no difference between them(i++ and i+=1). It is just easier to read what is happening with i+=1 and you can change the increment value, like i+=3 will increment i by 3 every loop.