0 votes
in JavaScript by
How do you empty an array in Javascript?

1 Answer

0 votes
by

You can empty an array quickly by setting the array length to zero.

let cities = ["Singapore", "Delhi", "London"];
cities.length = 0; // cities becomes []
...