the code is as follows:
var audio1 = new Audio("sounds/sleighride.mp3");
var audio2 = new Audio("sounds/letitsnow.mp3");
var audio3 = new Audio("sounds/comingtotown.mp3");
var array = ["audio1", "audio2", "audio3"]
function soundrandom (){
var songrandom = array[Math.floor(Math.random() * array.length)];
songrandom.play(); }
soundrandom();
//end
the answer may be obvious but has had me stumped for a bit, error is "soundrandom.play(); is not a function".
Aucun commentaire:
Enregistrer un commentaire