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
1// declares a 1D Array of string.
2string[] weekDays;
3// allocating memory for days.
4weekDays = new string[] {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
5// Display length of array.
6Console.Write(weekDays.Length);
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 colors = ["Red", "Orange", "Blue", "Green"];
2var colorsLength=colors.length;//4 is colors array length
3
4var str = "bug";
5var strLength=str.length;//3 is the number of characters in bug