JavaScript new Array()
Example
// Create an Array
const cars = new Array(["Saab", "Volvo", "BMW"]);
Try it Yourself »
const cars = new Array(["Saab", "Volvo", "BMW"]);
More Examples Below !
Description
The new Array()
constructor creates an Array object.
Syntax
new Array(iterable)
Parameters
Parameter
Description
iterable
Required.
An iterable object with values.
An iterable object with values.
Return Value
Type
Description
Array A new Array object.
Array Tutorials:
More Examples
Example
Create an empty array and add values:
// Create an Array
const cars = new Array();
// Add Values to the Set
cars.push("Saab");
cars.push("Volvo");
cars.push("BMW");
Try it Yourself »
const cars = new Array();
// Add Values to the Set
cars.push("Saab");
cars.push("Volvo");
cars.push("BMW");
Example
Create an array without the new Array() method:
// Create an Array
const cars = ["Saab", "Volvo", "BMW"];
Try it Yourself »
const cars = ["Saab", "Volvo", "BMW"];
Browser Support
new Array()
is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |