- 1

how to play audio in javascript

Js

14th Jan 2022, 7:19 PM
Henrique Claro
2 Answers
+ 5
Your question isn't clear. I'm not sure what exactly you're asking. (..Multiple ways to do it) But hopefully this could be it: const audio = new Audio("sound.mp3"); To play it: audio.play(); Or To pause it: audio.pause(); Refer to this if you want https://stackoverflow.com/questions/9419263/how-to-play-audio
14th Jan 2022, 7:51 PM
Isaac Fernandes
Isaac Fernandes - avatar
0
?
14th Jan 2022, 7:20 PM
Henrique Claro