How to get the size of a array using JavaScript

H

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

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me