Clear array using replacing with a new array
You can clear an array by replacing it with a new empty array. This is the fastest way if you don't have references to the original array anywhere else because a new empty array is created.
Clear array using the length property
You can clear an array using the length property, which returns the number of elements in that array. All array elements are automatically removed when the length property is set to zero. This method is quite popular but not the fastest way to get the job done.