Assessment wanted for Adding bouncing balls features-haydee

task page

my work page

I basically wasted 2 hours to debug my code because I don’t know the right method to
increment or decrement the count. I have no choice but look at the source code of the finished example.

my original code on score count:

 let para=document.querySelector('p')
let count=0;
for (const ball of balls) {
   if (balls.length++&&ball.exists){
      count++;
   }
   if (ball.exists===false){
      count--;
   }
}
para.textContent=`Ball count:${count}`;

I write these lines at the bottom of the js file. It’s truly a disaster :sob:

Hi @Austin_Hart

This looks very good. Congratulations! :medal_sports:

You twice used ... else { continue; }. This isn’t necessary since there is nothing left to be skipped and it would have the same effect if it was omitted and only the if { ... } was used.

Sometimes we bang our head at the wrong wall. There are times where we need to take a step back and look at the bigger picture. :wink: :smiley:

Have a nice Sunday,
Michael