Removing Elements with the length Variable
To delete elements from the end of the array: set the array's length variable to a number smaller than the current length:
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var toppings:Array = ["p", "t", "c", "g", "b"];
toppings.length = 3;
trace(toppings); //p,t,c
}
}
}
Related examples in the same category