Skip to content

JavaScript Array constructor property | create Array objects

  • by

JavaScript Array() constructor is used to create Array objects. The constructor property returns the function that created the Array prototype.


Use JavaScript Array constructor property

Simple example code constructor property.

<!DOCTYPE html>


   let languages = ["JavaScript", "Java", "Python"];

   let res = languages.constructor;




JavaScript Array constructor property

Array constructor with a single parameter

let fruits = new Array(2);

console.log(fruits.length); // 2
console.log(fruits[0]);     // undefined

Array constructor with multiple parameters

let fruits = new Array('Apple', 'Banana');

console.log(fruits.length); // 2
console.log(fruits[0]);     // "Apple"

Do comment if you have any doubts or suggestions on this JS Array topic.

Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.

OS: Windows 10

Code: HTML 5 Version

Leave a Reply

Your email address will not be published. Required fields are marked *