1var audio = new Audio("soundfile.wav");
2
3document.onclick = function() {
4 audio.play();
5}
1<script>
2function play() {
3 var audio = new Audio('https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3');
4 audio.play();
5}
6</script>
7<button onclick-"play();">PLAY MY AUDIO</button>