DEV Community

[Comment from a deleted post]
Collapse
 
quantumsheep profile image
Nathanael Demacon • Edited

The third way is waaaay too slow.

Why not using .splice()?

const arr = [1, 2, 3, 4, 5, 6];

arr.splice(0);

console.log(arr); // print []