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
1const clothing = ['shoes', 'shirts', 'socks', 'sweaters'];
2
3console.log(clothing.length);
4// expected output: 4
1
2const fruits = ["Banana", "Orange", "Apple", "Mango"];
3
4fruits.length // Returns 4
5