I’m having trouble removing an element from an array. my array is filename, and i want to randomly select one item, then remove it so it isn’t selected again.
here’s my code:
selectRandom = function(){
filename = ["p1_1.swf", "p1_2.swf", "p1_3.swf", "p1_4.swf", "p1_5.swf", "p1_6.swf"];
path = "http://a.parsons.edu/~lisa/spring05/interactivity/final/swfs/";
i = filename.length;
k = Math.floor(Math.random()*i);
randomFile = filename[k];
filename.splice(k,1);
return(randomFile);
return(path);
}
is there something I’m missing?