Yasmin Ledesma

Day 1/30: JavaScript Drum Kit #JavaScript30

Overview of the challenge

Wes Bos gives out a bunch of code and I'm supposed to make everything work by the end of the month?

Being December 1st, I decided to start with the JavaScript Drum Kit:

Basically, this exercise consist of taking the start HTML and CSS files, and link every single one of the buttons shown on the page to their assigned audio file, so it plays a sound everytime the user presses one of the keys. I'll also have to link every button to a custom CSS class so they do a little animation, and look cute, when pressed. So, let's do this.

Train of thought...

Drum Kit

  1. Make an event listener that adds the ".playing" class every time one of the keys on screen gets pressed.

  2. Try to make it so each key case plays it's assigned tune. Maybe make another function for that, then call it inside getKeys. Make it so every tune can get pressed again and again without a delay.

  3. Add another function that removes the class ".playing" once the key is up.

What I learned

And it's done!

You can find my solution to this challenge in its repository. You can also try it out live on CodePen!

#challenge #javascript