Skip to main content
InterviewHubPRO
Section Overview
Q371

Question 371 of 536

Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

69%
JavaScript & V8 Internals (536 Qs)•Part 6: Async Internals, Memory, Microtasks & Web APIs (329 - 403)

How do you empty an array

senior LevelCode ExampleAsync & PromisesEvent LoopData Structures

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

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