JavaScript question detail
How do you empty an array
You can empty an array quickly by setting the array length to zero.
let cities = ["Singapore", "Delhi", "London"];
cities.length = 0; // cities becomes []
JavaScript question detail
You can empty an array quickly by setting the array length to zero.
let cities = ["Singapore", "Delhi", "London"];
cities.length = 0; // cities becomes []