• JavaScript Video Tutorials

JavaScript - Array length Property



Description

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

Syntax

Its syntax is as follows −

array.length

Return Value

Returns the length of the array.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript Array length Property</title>
   </head>
   
   <body>   
      <script type = "text/javascript">
         var arr = new Array( 10, 20, 30 );
         document.write("arr.length is : " + arr.length); 
      </script>      
   </body>
</html>

Output

arr.length is : 3 
javascript_arrays_object.htm
Advertisements