1var numbers = [1, 2, 3, 4, 5];
2var length = numbers.length;
3for (var i = 0; i < length; i++) {
4 numbers[i] *= 2;
5}
6// numbers is now [2, 4, 6, 8, 10]
7
1var arr = [10,20,30,40,50]; //An Array is defined with 5 instances
2
3var len= arr.length; //Now arr.length returns 5.Basically, len=5.
4console.log(len); //gives 5
5console.log(arr.length); //also gives 5
1<html>
2 <head>
3 <title>JavaScript Array length Property</title>
4 </head>
5
6 <body>
7 <script type = "text/javascript">
8 var arr = new Array( 10, 20, 30 );
9 document.write("arr.length is : " + arr.length);
10 </script>
11 </body>
12</html>
1const clothing = ['shoes', 'shirts', 'socks', 'sweaters'];
2
3console.log(clothing.length);
4// expected output: 4