JavaScript new Array()
Example
// Create an Array
const cars = new Array(["Saab", "Volvo", "BMW"]);
Try it Yourself »
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. |
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 »
Example
Create an array without the new Array() method:
// Create an Array
const cars = ["Saab", "Volvo", "BMW"];
Try it Yourself »
Browser Support
new Array()
is an ECMAScript1 (ES1) feature.
ES1 (JavaScript 1997) is fully supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |