1) To create new array which, you cannot iterate over, you can use array constructor:

Array(100) or new Array(100)


2) You can create new array, which can be iterated over like below:

a) All JavaScript versions

  • Array.apply: Array.apply(null, Array(100))

b) From ES6 JavaScript version

  • Destructuring operator: [...Array(100)]
  • Array.prototype.fill Array(100).fill(undefined)
  • Array.from Array.from({ length: 100 })

You can map over these arrays like below.

  • Array(4).fill(null).map((u, i) => i) [0, 1, 2, 3]

  • [...Array(4)].map((u, i) => i) [0, 1, 2, 3]

  • Array.apply(null, Array(4)).map((u, i) => i) [0, 1, 2, 3]

  • Array.from({ length: 4 }).map((u, i) => i) [0, 1, 2, 3]

Answer from stpoa on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array › Array
Array() constructor - JavaScript | MDN
Arrays can be created using a constructor with a single number parameter. An array is created with its length property set to that number, and the array elements are empty slots.
Discussions

How to initialize empty array of objects?
const arr: {name: string}[] = [] Maybe like this? More on reddit.com
🌐 r/typescript
14
18
May 27, 2021
Empty an Array in JavaScript - Ask a Question - TestMu AI (formerly LambdaTest) Community
How can I clear an array in JavaScript? Is there a method like .remove() to empty an array? For example, if I have an array A = [1,2,3,4];, how can I empty it? More on community.testmuai.com
🌐 community.testmuai.com
0
June 6, 2024
How to declare and initialize an empty array of objects
I’m trying to declare an array of objects to add new objects later. I’m doing this away: private arrayOfObjects: [{}]; When I try to push some object to it I receive the following error: Cannot read property ‘push’ of undefined I believe this is because the array needs to be initialized. More on forum.ionicframework.com
🌐 forum.ionicframework.com
4
0
January 16, 2020
Arrays in JavaScript. Assigning empty ones? Adding values to it? Help!
Normally, we have a rule against complete answers, but I literally don't know how else to answer your question. x = [] x.push("French") More on reddit.com
🌐 r/learnprogramming
6
0
May 18, 2018
🌐
W3Schools
w3schools.com › jsref › jsref_array_new.asp
JavaScript new Array Method
new Array() called with no arguments, creates an empty array.
🌐
Quora
quora.com › How-do-you-declare-an-empty-array-in-JavaScript
How to declare an empty array in JavaScript - Quora
Answer (1 of 19): You have two main ways to go: simple declaration with square brackets. const myArray = [] Or instantiation of the Array Object using the constructor method: const myArray = new Array() The trendy kids favor the first way, nowadays, with the empty square brackets, but if you h...
🌐
W3Schools
w3schools.com › js › js_arrays.asp
JavaScript Arrays
JavaScript has a built-in array constructor new Array(). But you can safely use [] instead. These two different statements both create a new empty array named points:
🌐
Code Like A Girl
code.likeagirl.io › create-an-array-of-empty-arrays-7ec77edea546
How to create an array of empty arrays | by Ai-Lyn Tang | Code Like A Girl
June 25, 2019 - For two exercises in exercism.io (Matrix and Pascal’s Triangle), I have wanted to create an array of empty arrays. There are lots of ways to do this. My newbie mind defaults to forEach, for loops or while loops.
Find elsewhere
🌐
daily.dev
daily.dev › home › blog › webdev › js create array of objects: simplified
JS Create Array of Objects: Simplified | daily.dev
May 25, 2026 - By now, you've learned quite a bit about working with arrays of objects in JavaScript. Let's go over what we've covered: Creating empty arrays - You know how to start with an empty array like let cars = [] and get it ready to fill with objects.
🌐
Medium
medium.com › @ryan_forrester_ › empty-arrays-in-javascript-how-to-guide-f8643da412c2
Empty Arrays in JavaScript (How to Guide) | by ryan | Medium
October 30, 2024 - Handling arrays is a fundamental part of JavaScript programming, and understanding how to work with empty arrays is crucial for various applications. This guide will provide you with a detailed understanding of how to create, check, and manipulate empty arrays in JavaScript, including practical ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Array
Array - JavaScript | MDN
July 28, 2026 - Note: If you're not yet familiar with array basics, consider first reading JavaScript First Steps: Arrays, which explains what arrays are, and includes other examples of common array operations. This example shows three ways to create new array: first using array literal notation, then using the Array() constructor, and finally using String.prototype.split() to build the array from a string.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › creating-a-zero-filled-array-in-javascript
JavaScript- Creating a Zero-Filled JS Array - GeeksforGeeks
July 23, 2025 - ... The same result can be obtained by passing an object with the length property using the Array.from() method. ... JavaScript for loop is used to iterate the elements for a fixed number of times.
🌐
C# Corner
c-sharpcorner.com › blogs › initializing-empty-arrays-in-javascript1
Initializing Empty Arrays in JavaScript
It initializes the array with the number of elements equal to the number of commas used inside square brackets []. So in the above case, the array's length will be 2 instead of 3.
🌐
TutorialsPoint
tutorialspoint.com › article › create-empty-array-of-a-given-size-in-javascript
Create empty array of a given size in JavaScript
March 15, 2026 - In JavaScript, you can create an empty array of a given size using several approaches. The most common method is using the constructor. The creates an array with the specified length, but all elements are undefined (empty slots).
🌐
Medium
medium.com › @wisecobbler › 4-ways-to-populate-an-array-in-javascript-836952aea79f
4 Ways to Populate an Array in JavaScript | by Sophia Shoemaker | Medium
December 5, 2018 - In this approach, we are creating an array with ten empty slots, then filling those slots with the null value, then creating a new array with unique objects.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › create-an-array-of-given-size-in-javascript
Create an Array of Given Size in JavaScript - GeeksforGeeks
The basic method to create an array is by using the Array constructor. We can initialize an array of certain length just by passing a single integer argument to the JavaScript array constructor.
Published: July 23, 2025
🌐
TestMu AI Community
community.testmuai.com › ask a question
Empty an Array in JavaScript - Ask a Question - TestMu AI (formerly LambdaTest) Community
June 6, 2024 - How can I clear an array in JavaScript? Is there a method like .remove() to empty an array? For example, if I have an array A = [1,2,3,4];, how can I empty it?
🌐
Medium
allaboutcode.medium.com › javascript-how-to-create-and-fill-an-empty-array-with-a-given-size-ed6954355a5f
JavaScript — How to create and fill an empty array with a given size? - Marika Lam - Medium
November 17, 2022 - JavaScript · Array · Marika Lam ... "" 1) To create new array which, you cannot iterate over, you can use array constructor: Array(100) or new Array(100) 2) You can create new array, which can be iterated over like below: a) ...
🌐
JavaScript Tutorial
javascripttutorial.net › home › 4 ways to empty an array in javascript
4 Ways to Empty an Array in JavaScript
January 31, 2020 - In this solution, the splice() method removed all the elements of the a array and returned the removed elements as an array. The fourth way to empty an array is to remove each element of the array one by one using the while loop and pop() method:
🌐
freeCodeCamp
freecodecamp.org › news › check-if-javascript-array-is-empty-or-not-with-length
How to Check if a JavaScript Array is Empty or Not with .length
October 5, 2020 - The ! operator negates an expression. That is, we can use it to return true if an array is empty. For this example, let's open up our JavaScript console. To open up your console in Chrome, you can click Inpsect -> Console. First, create an array with no items in it.
🌐
Ionic Framework
forum.ionicframework.com › ionic framework › ionic-v3
How to declare and initialize an empty array of objects - ionic-v3 - Ionic Forum
January 16, 2020 - I’m trying to declare an array of objects to add new objects later. I’m doing this away: private arrayOfObjects: [{}]; When I try to push some object to it I receive the following error: Cannot read property ‘push’ of undefined I believe this is because the array needs to be initialized.