Themans

What's the Fastest Way to Empty an Array?

Asked by Themans 2 years ago array


Devone
0
 
This is one of the fastest if not THEE fastest way to empty an array. With this technique you won't need to create a new array, it will let you reuse the same exact array:

Var myArray = ["one", "two", "three"];

// console.log( myArray ) => ["one", "two", "three"]

myArray.length = 0;

// console.log( myArray ) => []

by Devone 2 years ago

Answer this question

What's the Fastest Way to Empty an Array?

0 errors found:

 
0