How to empty an Array in JavaScript

Here I will show you correct way of emptying an array in javascript.
This is very common thing each developer do very often but Many times it is done in wrong way.
I have seen many developer creating new array like this:

myArray = [] // very bad method of emptying an array

best way to do it is really very easy.
Emptying an array means removing its values i.e. making its length zero.
So we can Just set the length property to zero like this:

myArray.legth = 0 // just making length zero instead of creating new array like above

Just by setting length equal to zero will make existing array empty and will not create any new array , Which also helps to avoid pointer issues arrays also.