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 trialAngel Franco
Front End Web Development Techdegree Graduate 15,220 Pointsmissed variable only increments once
So when the else if statement is true it increments the missed counter by 1 but it only the first it increments it from 0 to 1 but the following times it doesn't increment it stays at 1.
const checkLetter = arr =>{ const matched = ''; let missed = 0; for (let i = 0; i < lists.length; i++) { if (eve.textContent == lists[i].textContent) { li[i].classList.add('show'); matched.value += eve.textContent; } else if(i = lists.length ){ missed += 1; console.log(missed); } } };
1 Answer
Loukas Piloidis
6,700 PointsHi Angel,
I am not sure I understand exactly what the problem might be, but here is one possible cause:
Your operators '=', '==', etc, might not be used correctly. Check the link below for more information on JS operators.
https://www.w3schools.com/js/js_operators.asp
I hope this helps :)