How to find the length of an array in JavaScript?

JavascriptWeb DevelopmentFront End Technology

To find the length of an array, use the JavaScript length property. JavaScript array length property returns an unsigned, 32-bit integer that specifies the number of elements in an array.


You can try to run the following code to find the length of an array −

Live Demo

      <title>JavaScript Array length Property</title>
         var arr = new Array( 50, 60, 70, 80 );
         document.write("arr.length is : " + arr.length);


arr.length is : 4
Published on 12-Feb-2018 12:15:39