0

Can't understand the Array.length function clearly. Can someone elaborate?

17th Jun 2018, 6:55 AM
Abbhinav Bharadwaj
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. :)
17th Jun 2018, 7:23 AM
Janning⭐
Janning⭐ - avatar
+ 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! :)
17th Jun 2018, 7:10 AM
Janning⭐
Janning⭐ - avatar
+ 1
Janning mhmm i know :) Thanks for help :D
17th Jun 2018, 8:08 AM
Abbhinav Bharadwaj
+ 1
👍
17th Jun 2018, 8:09 AM
Janning⭐
Janning⭐ - avatar
+ 1
Janning I am not sure what that means
18th Jun 2018, 2:03 AM
Abbhinav Bharadwaj
+ 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. :)
18th Jun 2018, 2:56 AM
Janning⭐
Janning⭐ - avatar
0
Janning Actually I know what an array is, I didn't understood its "length function IN JAVA" Means how it works and all.
17th Jun 2018, 7:13 AM
Abbhinav Bharadwaj
0
Janning You sure it's for Java and not JavaScript?
17th Jun 2018, 7:25 AM
Abbhinav Bharadwaj
17th Jun 2018, 7:26 AM
Janning⭐
Janning⭐ - avatar
0
JavaScript is based on Java, so no surprise that they are incredibly similar. https://auth0.com/blog/a-brief-history-of-javascript/
17th Jun 2018, 7:30 AM
Janning⭐
Janning⭐ - avatar
0
length is not a method but a final instance variable of array class.
17th Jun 2018, 9:47 AM
Nikhil Sharma
Nikhil Sharma - avatar
0
Thanks for reading the article?
17th Jun 2018, 6:55 PM
Janning⭐
Janning⭐ - avatar
0
Janning Yeah I can get it 😂😂😂
18th Jun 2018, 3:49 AM
Abbhinav Bharadwaj