How to get the size of a array using JavaScript

No Comments

To get the total size of the array elements within an JavaScript array the JavaScriptlength property can be used.

E.g.

	var arr = new Array();
 
	arr[0] = 'val 1';
 
	arr[1] = 'val 2';
 
 
 
	alert(arr.length); //Will output 2

Image Credits: Photo by Isis França on Unsplash.

Related Articles

No results found

Leave a Reply

avatar
  Subscribe  
Notify of
Menu
Copy link