slice() accepts negative numbers, which count from the end of the array rather than the beginning. : Slice : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Slice »

 

slice() accepts negative numbers, which count from the end of the array rather than the beginning.


 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var metals:Array = ["iron""copper""gold""silver""platinum""tin","chrome"];
        var canMakingMetal:Array = metals.slice(-2,-1);
        trace(canMakingMetal)// Displays: tin

    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» Slice