. Advertisement .
..3..
. Advertisement .
..4..
I’m trying to Set Length Of Array in Angular but still no success. If anyone has the answer, please let me know. Many thanks!
var len= arr.length;
In the syntax shown above, it is evident that we have provided the name of the array and the length of the array must be calculated. The function returns an integer value equal to the total amount of elements contained in the array given by way of argument. For example:
var arr = [10,20,30,40,50]; //An Array is defined with 5 instances
var len= arr.length; //Now arr.length returns 5.Basically, len=5.
console.log(len); //gives 5
console.log(arr.length); //also gives 5
In case you expect more than one maximum this will work