Can i create multiples functions inside for loop?
var mySound1 = new buzz.sound( "laser-01", { formats: [ "ogg", "mp3", "acc" ]});
var mySound2 = new buzz.sound( "alien-noise-01", {formats: [ "ogg", "mp3", "acc" ]});
var sound = [mySound1, mySound2]
// additional sounds
var $i;
for ( $i = 0; $i< sound.length; $i++){
function playsound[$i](){
a[$i].play().fadeIn().loop();
}
}
playsound1();
You’d be better off just passing $i as a parameter to the playsound function
And if you really want the
playsound1()style function name, you could eval it (though I suggest against adding this):