Mainkan suara javascript
var audio = new Audio("folder_name/audio_file.mp3");
audio.play();
Combative Cheetah
var audio = new Audio("folder_name/audio_file.mp3");
audio.play();
var audio = new Audio("soundfile.wav");
document.onclick = function() {
audio.play();
}
<script>
function play() {
var audio = new Audio('https://interactive-examples.mdn.mozilla.net/media/examples/t-rex-roar.mp3');
audio.play();
}
</script>
<button onclick-"play();">PLAY MY AUDIO</button>
var bMusic = new Audio('welcome1.mp3')
bMusic.play()
<audio id="foobar" src="yoursample.ogg" preload="auto">
// inside JS File
setTimeout(() => {
document.getElementById('mySound').play();
}, 500)
// inside HTML File
<audio id="mySound" src="sound.mp3"></audio>