Finding array of length without using length method in javascript
var a = [10,20,30,40];
function arrayLen(){
let length = 0;
while (a[length]!==undefined){
length++;
}
return length;
}
console.log(arrayLen(a));
var a = [10,20,30,40];
function arrayLen(){
let length = 0;
while (a[length]!==undefined){
length++;
}
return length;
}
console.log(arrayLen(a));