var arr = [1,2,3,4,5];
To empty this array, you can use one of the following methods:
Reassign the array to an empty array. Here is how to do it.
arr = ; // reassign array to empty one
Reset the length of an array to 0. Here is how to do it.
arr.length = 0;
Using splice() function.
Here is how to do it.
This approach will actually return an original array after removing each item from position 0 of an array to the last index.