+ 1

Is the purpose of Length to declare how many values(things) are in the course(the example)/category?

not sure if i asked the question right.

26th Jan 2017, 5:20 PM
Codie Richards
Codie Richards - avatar
3 odpowiedzi
+ 1
I think U r asking about array in js Array is nothing but a kind of object & 'length' is a built-in property of array length property simply returns the count (nos.) of elements in an array
26th Jan 2017, 6:13 PM
codeDEcode
codeDEcode - avatar
0
length is a property of objects and strings. .length default is 0. var arraySample = ["obj1","obj2"]; alert(arraySample.length); returns 2 var placeholder = ""; for(var i =0; i < arraySample.length;i++){placeholder+=arraySample[i]; alert(placeholder);} will count the length of the array and iterate until i is no longer less than the array's length. var thisString = "this is a string."; alert(thisString.length); returns 16 as there are 16 characters including whitespace.
27th Jan 2017, 5:25 AM
Louis Milotte
Louis Milotte - avatar
- 1
I am just now starting Intro to Java in college, but what I gather is the length method counts the characters in the named variable in the system.out.print/println argument.
26th Jan 2017, 6:02 PM
Shawn