DEV Community

Discussion on: 3 ways to empty an Array in JavaScript

Collapse
 
sturpin profile image
Sergio Turpín

Good post Sanchithasr!

I know another, but it's slower in terms of performance

while (baratheon.length > 0) {
    baratheon.pop();
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
sanchithasr profile image
Sanchithasr

Yes. It's very slow when it comes to performance.

Some comments have been hidden by the post's author - find out more