How to access 2 nested arrays in JavaScript?

Could someone help me that how to access 2 nested arrays at the same time?

For example:

const nestedArr = [[1], [2, 3]];
**console.log(nestedArr[1]); **
// Output: [2, 3]

This will access the nested array which index is 1.

const nestedArr = [[1], [2, 3]];
**console.log(nestedArr[1][0]); **
// Output: 2

This will access the element which index number is 0 from the nested array which index is 1.

So, what is the way to access 2 arrays in a single line?

Below is the link with the exercise.

what do you mean by this? Could you provide an example? What is the data and what is the expected output?

Thank you stetim94!

For example:

const newAnimalArr = [[‘bird’, ‘eagle’], [‘elephant’, ‘giraffe’], [‘shark’], [‘pig’], [‘sheep’]];

console.log(newAnimalArr[2]); //output; [‘shark’]
console.log(newAnimalArr[3]); //output; [‘pig’]
console.log(newAnimalArr[4]); //output; [‘sheep’]

The code above can access [‘shark’], [‘pig’], [‘sheep’] separately.
How can I log [‘shark’], [‘pig’], [‘sheep’] within one clause?

That doesn’t have anything to do with nested arrays does it, you could just as well say that you wanted to look up three integers

let stuff = [1, 2, 3, 4, 5, 6]

(and nested arrays aren’t special anyway, are they? an array can refer to values, and an array is a value)

Does logging have anything to do with it? Are you talking about writing output, or making lookups?

So, maybe it would be better to talk about some operation. What would the input to this operation be, would it be multiple values or one value, and which? And what would the output be?

Maybe the input would be an array of indices and an array of values, and you’d want an array containing the values at those indices in that order.