JavaScript Array length Property- Tutorialpath

Welcome to all our readers on our website at As you all know that here on our website we will provide you lots of information related to the latest and newly introduced technology which help you to get updated with the latest tech. Here you will get all the useful information which is required in this tech world. As you know technology is one of the trending part in this world. So, here again we came up with a latest and new tech information which is related to the process of creating JavaScript Array length property. With the help of this article you will get to know the complete process of how to create JavaScript Array length property in a step by step manner. So, simply have a look to this article and grab all the useful information which is going to be very helpful for you.


JavaScript – Array length Property

We can find the length or size of any JavaScript array length by using its length property.


To access the elements of the array we can use this length property to loop through. Please note that first element of an array starts from 0 so array_name[1] is the second element of the array where as array_name[0] is the first element of the array. Same way the last element of the array is the total size of the array minus one.

Return Value

Returns the length of the array.




The value of the length property is an integer with a positive sign and a value less than 2 to 32nd power (232).

var namelistX = new Array(4294967296); //2 to the 32nd power = 4294967296 
var namelistZ = new Array(-100) //negative sign

console.log(namelistX.length); //Error: array length is Invalid 
console.log(namelistZ.length); //Error: array length is Invalid 

var namelistY = []; 
namelistY.length = Math.pow(2,32)-1; //set array of length less than 2 to the 32nd power 

You can set the length property to shorten an array at any time.

When you expand an array by changing its length property, the number of real elements increases;

For example, if you currently set length 3 to be 2, the array now includes 3 elements, which makes the third element a non-moveable empty slot.

Property attributes of  ‘Array.Length’

Writable Yes
Enumerable No
Configurable No
  • Writable: If this attribute is set to false, the value of the property cannot be changed.
  • Configurable: If this attribute is set to false, then any attempt to delete the property or change its properties (Writable,Configurable or Enumerable ) will fail.
  • Enumerable : If this attribute is set to true, the property will be iterated over during loops.


So, hopefully we had shared all the basic steps which help you to JavaScript Array length property. If you are using any of the above given browser and the steps helps you to enable or disable the JavaScript then simply share this article with others and also tell us by dropping a comment in the comment section below so that we get to know how helpful this article is for you all.

Leave a Reply

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