Hellow fellow campers, I believe you are all well and fine
recently i took a break from freecodecamp challenges and getting tough time on javascripts sections but atleast i managed to finish and i decided to start Javascript30 before starting Front End Libraries Certification to be more familiar on javascript but things is not going so well. the first project i started and i cant get any functionality(my drum does not work) despite following all the steps of the tutor and here is the exact code from the tutorial and i would appreciate your advice and recommendations.
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="utf-8">
<title>DRUM MACHINE</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="keys">
<div data-key="65" class="key">
<kbd>A</kbd>
<span class="sound">clap</span>
</div>
<div data-key="83" class="key">
<kbd>S</kbd>
<span class="sound">hihat</span>
</div>
<div data-key="68" class="key">
<kbd>D</kbd>
<span class="sound">kick</span>
</div>
<div data-key="70" class="key">
<kbd>F</kbd>
<span class="sound">openhat</span>
</div>
<div data-key="71" class="key">
<kbd>G</kbd>
<span class="sound">boom</span>
</div>
<div data-key="72" class="key">
<kbd>H</kbd>
<span class="sound">ride</span>
</div>
<div data-key="74" class="key">
<kbd>J</kbd>
<span class="sound">snare</span>
</div>
<div data-key="75" class="key">
<kbd>K</kbd>
<span class="sound">tom</span>
</div>
<div data-key="76" class="key">
<kbd>L</kbd>
<span class="sound">tink</span>
</div>
</div>
<audio data-key="65" src="sounds/clap.mp3"></audio>
<audio data-key="83" src="sounds/hihat.mp3"></audio>
<audio data-key="68" src="sounds/kick.mp3"></audio>
<audio data-key="70" src="sounds/openhat.mp3"></audio>
<audio data-key="71" src="sounds/boom.mp3"></audio>
<audio data-key="72" src="sounds/ride.mp3"></audio>
<audio data-key="74" src="sounds/snare.mp3"></audio>
<audio data-key="75" src="sounds/tom.mp3"></audio>
<audio data-key="76" src="sounds/mp3.mp3"></audio>
<script>
function playSound(e){
const audio = document.querySelector(`audio[data-key="${e.keycode}"]`);
const key = document.querySelector(`.key[data-key="${e.keycode}"]`);
if (!audio) return; //stop function from running altogether
audio.currentTime = 0; //rewind to the start
audio.play();
key.classList.add('playing');
}
function removeTransition(e){
if (event.propertyName !== 'transform') return; //skip if its not a transform
this.classList.remove('playing');
}
const keys = document.querySelectorAll('.key')
keys.forEach(key => key.addEventListener('transionend', removeTransition));
window.addEventListener('keydown', playSound);
</script>
</body>
</html>