To play a notification sound on websites with JavaScript, we call the play
method.
For instance, we write
const audio = new Audio(url);
audio.play();
to create an audio element with the audio url
with the Audio
constructor.
Then we call play
to play the clip.