+ 5

Length of array inside array

let arr = [ [1, 2, 3], [1, 2, 3], [1, 2, 3], [1, 2, 3] ]; Here, If we write arr.length we get 4. How can we get the length of the array inside the main array (which is 3)?

2nd Aug 2020, 3:50 AM
Kashyap Kumar
Kashyap Kumar - avatar
1 Resposta
+ 8
just simple. arr[0].length;
2nd Aug 2020, 3:58 AM
Maninder $ingh
Maninder $ingh - avatar