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
KAREN ROSS
3,026 PointsWhy repeat textContent as below? listItems[i].textContent = listItems[i].textContent.toLowerCase();
I don't understand why listItems has textContent attached and then its used again.
4 Answers
Zachary Kaufman
1,463 PointsIs this for a specific lesson or code challenge, your question confuses me...
KAREN ROSS
3,026 PointsThis was copied from a video. Javascript and the DOM. He used 'textContent' twice with list items and I'm unclear as to why.
listItems[i].textContent = listItems[i].textContent.toLowerCase();
Zachary Kaufman
1,463 PointsOh okay well basically what he is doing is changing listItems[i].textContent to being the exact same thing (hence why he repeats it) but to make it lower case. So if you look at the equation listItems[i].textContent = listItems[i].textContent.toLowerCase(); its saying listItems[i].textContent IS listItems[i].textContent but lowercase. So he is forced to repeat himself.
KAREN ROSS
3,026 PointsOh is that all? Ok cheers!