Test says no audio plays even though audio does indeed play

Tell us what’s happening:
Hello everyone. When I run the tests on the codepen below, it tells me that sound doesn’t play when it does. I’m guessing it’s some sot of browser compatibility thing, but since I don’t know the testing environement, it’s hard to debug. Cansomeone provide some answer ?

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14324.62.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.77 Safari/537.36

Challenge: Build a Drum Machine

Link to the challenge:

Hello @Morgade
Though it is working the tests won’t pass. I guess the tests are written in a way that they cannot access your code due to the complexity.

Not sure about the purpose of using key = e.code.slice(-1); and a switch statement… there is a property known as key available in the e (ie. event) object you could simply access e.key and pass it to the PlayAudio component by converting it into uppercase.

I tried the above solution and it passed the test case.

The purpose is to make “keyX” into “X” so I can pass it to my playAudio function and since I’m using an azerty keyboard, I need the A/Q and Z/W couples to be inverted.

e.key works better than the slice though, for sure. And I don’t even have to invert the keys, wonderful.

Thank you for your help !