Drum Machine - functions as intended but not passing 2 tests

I’ve coded a drum machine which works as intended, clicking the button plays the correct sound, pressing the designated key plays the right sound. The description is accurate when a sound is played.

But for some reason it isn’t passing the test case.


This is my code as of now. Any suggestions on how to pass the test cases?

I think this is the problem.

Your id’s like Kick, Snare, etc are not matching the tests. The tests are expecting id = ‘Q’, id = ‘W’, and so forth.

The button id’s are expected to be ‘kick’, ‘snare’, etc.

The audio id’s are expected to be ‘q’, ‘w’, etc.

I don’t think this is causing tests to not pass, if anything I think it would cause more tests to fail by changing it

You have to call play on the actual audio element and not using the Audio() constructor.

Example for the onClick
playSound({ target }) {
    soundPlayed: drumSounds.find(
      (drumSound) => drumSound.id === event.target.id
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.