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 trialIgor Pavlenko
12,925 Pointschallenge question
did not the get the part why you have to capitalise tags in the if statement?
plz explain?
listHide.addEventListener('mouseover', (event) => {
if (event.target.tagName == 'LI') {
event.target.textContent = event.target.textContent.toUpperCase();
}
});
listHide.addEventListener('mouseout', () => {
if (event.target.tagName == 'LI') {
event.target.textContent = event.target.textContent.toLowerCase();
}
});
2 Answers
brandon downs
11,577 PointsYou would want to write the if statement like this
If (blah.blah.toUpperCase() == 'BLAHBLAH') { Then do something }
(The blahs are just space fillers/ example/ not words you need to use)
It makes the user input all upper case letters, and then checks to see if that is equal to the upper case answer that you defined. This way you don't need to worry about users writing the answer using inconsistent capitalization of numbers.
Abhijit Das
5,022 Pointsonce you click on any element, tag name property always return the element name as capitalization, therefore in if statement it checks that.