0
Can't understand the Array.length function clearly. Can someone elaborate?
13 Respostas
+ 2
Sure. :) So array.length fetches the size of the array (number of items in the array) for you. Better than counting by hand anyway.
It's really not that much more complicated. I think sometimes we overthink it.
It can be handy for situations where you want to do something to every item in the list, so you tell the program to do it array.length times. Just as an example of how it can be used. There are certainly more creative uses out there, once you get going. :)
+ 1
An array is a set or list of items.
The array's length is the number of items in that list or set.
I hope this helps! :)
+ 1
Janning mhmm i know :) Thanks for help :D
+ 1
đ
+ 1
Janning I am not sure what that means
+ 1
No worries. Nikhil made a comment, which is covered in more depth in the article provided, but I think ends up confusing the matter for practical purposes. :)
0
Janning Actually I know what an array is, I didn't understood its "length function IN JAVA"
Means how it works and all.
0
Janning You sure it's for Java and not JavaScript?
0
JavaScript is based on Java, so no surprise that they are incredibly similar.
https://auth0.com/blog/a-brief-history-of-javascript/
0
length is not a method but a final instance variable of array class.
0
Thanks for reading the article?
0
Janning Yeah I can get it đđđ