how to play sounds in js with button code example
Example 1: javascript play sound onclick
var audio = new Audio("soundfile.wav");
document.onclick = function() {
audio.play();
}
Example 2: how to play sound on load js
var sample = document.getElementById("foobar");
sample.play();