Let’s say the following is our nested array −
var numbers = [100, 1345, 80, 75, 1000,[35, 55, 67,43,51,78]];
You can take length of first array and can go into the nested array.
Example
The code is as follows fetching nested array value −
var numbers = [100, 1345, 80, 75, 1000,[35, 55, 67,43,51,78]]; var insideInnerValue = numbers[5]; var value = insideInnerValue[5]; console.log(value);
To run the above program, you need to use the following command −
node fileName.js.
Here, my file name is demo264.js.
Output
This will produce the following output on console −
PS C:\Users\Amit\javascript-code> node demo264.js 78