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 Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Perform: Appending and Removing Elements

Jacob Tennyson
Jacob Tennyson
6,240 Points

Error in JS

Uncaught ReferenceError: Invalid left-hand side expression in postfix operation

//cycle ove rincompleteTaskHolder ul list items 
for(var index = 0; index < incompleteTasksHolder.children.length; 1++)
{
    //bind events to list items children (taskCompleted)
  bindTaskEvents(incompleteTasksHolder.children[i], taskCompleted);
}

Suggestions?

Roberto Alicata
Roberto Alicata
Courses Plus Student 39,959 Points

you wrote 1++ in the FOR loop instead of index++ and you used the variable i inside the loop but you must use index

Roberto has got it. Try i++ instead of 1++.

1 Answer

Chad Dugas
PLUS
Chad Dugas
Courses Plus Student 13,304 Points

You also cant use .children[i] if you are going to call your variable index. You have to put .children[index].