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
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
1var nums = new Array();
2nums[0] = 1;
3nums[1] = 2;
4print(nums.length); // displays 2
5