Skip to content


Erasing All Items in an Array with Slice Method

Because I occasionally build arrays with the push method, there was an occurrence where I need to wipe it out entirely. I was able to do so with the Slice Method. It is simply:

myArray.slice ( 0 );

The parameter of 0 will wipe out all items after the first element of your array. It will accept a second parameter which will act as a delimeter for clearing items, -1 value will be the last item in the Array.

Posted in Actionscript 3, Arrays.


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Mike says

    hi hi, from what i can, according to your statement, myArray.slice(0) will return a new array which consist of the first element of myArray. however, it doenst mean that the element in the myArray being deleted/erased.



Some HTML is OK

or, reply to this post via trackback.