Length of array inside array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
+ 8
just simple. arr[0].length;
2nd Aug 2020, 3:58 AM
Maninder $ingh
Maninder $ingh - avatar