Skip to main content
InterviewHubPRO
Section Overview
Q374

Question 374 of 536

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

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

How do you create an array with some data

senior LevelCode ExampleAsync & PromisesEvent LoopData Structures

You can create an array with some data or an array with the same values using fill method.

javascript
  var newArray = new Array(5).fill("0");
  console.log(newArray); // ["0", "0", "0", "0", "0"]