1var array = [1, 2, 3, 4, 5]; // array of size 5
2
3var size = array.length; // add.length to get size
4
5console.log('size : '+size);
6//output: size : 5
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