views:

14

answers:

0

I'm building a simple game using a canvas tag and want to add some sound effects to it. If I use the following code to play the SFX...

function playSfx( sound ) {
 var snd = new Audio("file.mp3");
 snd.play();
}

Is the garbage collection / memory management clever enough to play the sound and then dispose of the Audio object? Or will I have to keep track of the object and destroy it when it has finished playing?