I have a simple word guessing game and spacebar is required to start. I wanted to play music along with this without any HTML but, no luck. Anybody able to help with this? I'm not getting any DOM errors either.
// press spacebar to start game
function startGame() {
document.body.onkeyup = function(e){
if(e.keyCode == 32){
start();
checkInput();
document.getElementById('startBanner').style.display = 'none';
let audio = new Audio('assets/audio/final_fight_selection.mp3')
audio.play();
}
}
}