Drum Machine error

I’m doing the drum machine challenge and i don’t know what am i doing wrong!!

it keeps saying that when i click the drumpad letter it doens’t call the sound file within the audio element… but it’s actually working…

the error is: 5. When I click on a .drum-pad element, the audio clip contained in its child

the codepen is this: Drum machine (codepen.io)

const audio = new Audio(event.target.children[0].src);
audio.play();

I don’t think you want to create a new Audio object. You want to call play directly on the audio element in the DOM.

1 Like

As said, play() has to be called on the element.

Log out event.key in your handleKeyPress handler and run the tests.

1 Like

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