FCC Challenge - Drum Machine

Hi Campers!

I’m pretty new to React and all stuff, but managed to do all the course so far, but I need some help from the experts.
This is the 2nd project I try to build in React, and I couldn’t understand on how to do some stuff.

What’s puzzling me in this challenge, is that, I can make everything work, and I’ve already tried in several different ways, but I couldn’t pass the tests. And nevertheless, when I try to see if I pass the challenge, it changes from 8 to 11 challenges!

Can please the experts tell me what am I doing wrong? Here’s the link to my codepen:


Thanks in advance!

ReferenceError: audio is not defined

Seems to be the problem. This error fires after each click. But your sound does play. Perhaps you are referencing something unnecessarily, or double referencing, one is correct but this one is wrong. I also did not see this audio defined anywhere.

1 Like

Thanks, Emgo-Dev! you’ve pointed me in a right direction. I took out that problem (in the first time I did the sample, I was creating an audio object instead of playing directly from the node - an apparently I forgot to clear out an audio.play() from line 96.), and now the test is passing 7 from 8.

I’m going to take a look further. Thank you for your help! I must have been too tired not to look in the console yesterday… :slight_smile:

I’m going to rewrite it from scratch. I’ve compared with the full example to find out WHERE I am making mistakes, and I really couldn’t find it. I’ll leave it in the same codepen to see if anyone finds out why it doesn’t pass the tests… and I’ll start over in another pen :slight_smile:

Hey Everyone!

Can somebody please figure out why I’m unable to pass test case #6:

**_

“When I press the trigger key associated with each .drum-pad, the audio clip contained in its child <audio> element should be triggered (e.g. pressing the Q key should trigger the drum pad which contains the string “Q”, pressing the W key should trigger the drum pad which contains the string “W”, etc.).”

_**

I’ve reviewed my code several times, but I just can’t seem to find the problem? Maybe a more experienced camper will be able to see the error.

Thanks in advance!

FCC Drum Machine