Can't play audio from drum-machine in Codepen

So I built a drum machine that works perfectly when I open it from Visual Code Studio. But when I copy the code into codepen it fails to recognize everything that should happen when you click a button or press one of the keys. There is no sound and the display doesn’t change.

I have no idea what’s going on, so if anyone could help me on this one, it would be amazing.

Here’s a link to the codepen project:

Link to the challenge:

Check your developer tools. Your errors center around " this.audio.play(); is not a function" and this.audio.currentTime = 0;

You’d probably get more responses by posting under Javascript or Project Feedback.

1 Like