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.
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.