Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript DOM Scripting By Example Editing and Filtering Names Fix DOM Manipulation Code

Arihant Tripathy
Arihant Tripathy
8,764 Points

How do I do this?

How do I embolden the list item with the corresponding index?

1 Answer

Brendan Whiting
.a{fill-rule:evenodd;}techdegree seal-36
Brendan Whiting
Front End Web Development Techdegree Graduate 84,692 Points

Right now there's an if block on line 12 where the condition is always false. They need you to change this condition so that it's true only if the number in the text field is the same as the index of the list item.

We're inside a for loop and each list item has an index i as we're iterating through. There's also a variable index where we're storing the number from the text field. So we want to check to see if i and index are the same.

Let me know if you have more questions.