This is a very simple javascript click count. I eventually want to make one of these reaction testing games, but I don’t want to do it with the help of others.

Prepare

Plan

It’s going to be a simple page with a headline, some instructions and a counter. That’s it!

Perform

I Had some difficulties with the part where a message appears when you hit a certain number of clicks. I tried with a switch statement, but couldn’t get it to work.

switch (counter) {
 case 31:
   message.innerHTML = "<h2>It's a 30</h2>";
 case 21:
   message.innerHTML = "<h2>It's a 30</h2>";
 case 11:
   message.innerHTML = "<h2>It's a 30</h2>";
 }

It ended up being all broken. I got frustrated. So I crammed out this semi-gigantic if statement. At least it does what I want it to do.

Perfect

Ridiculously easy. I know. But I got to try the addEventlistener at least.

It’s been a rough couple of weeks with a lot of work, so I’m just happy I got to squeeze in some coding.

I’ve also done some algorithms on Freecodecamp. Almost finished with those. I can’t wait to begin with the Advanced Front End Development Projects. I find my self thinking about them all the time.

About the algorithms though. I struggle a lot with them. I guess I have to do them over and over again. At least a few times.

 

Yeah.. So. Check out Project 10.