How to empty an array?

How to empty an array?

const arr = [1,4,6];

arr =  []; 

Or

arr.length = 0; 

Or

arr.splice(0, arr.length); 

Or

while (arr.length > 0) { arr.pop(); }

Comments

Popular posts from this blog

world tourism guide Template

Es6 how to check if value is not null or undefined?