splice serve a togliere o aggiungere elementi ad un array, mentre lo slice serve a restituire un nuovo array compreso tra gli indici passati.codice:Array.prototype.deleteElement = function(element) { var len = this.length; for(var i = 0; i < len; i++){ if(this[i] == element){ this.splice(i, 1); return true; } } return false; }; a = new Array(); a.push ("1", "5", "3"); a.sort(); trace(a); a.deleteElement("3"); trace(a);

Rispondi quotando