Nested array of variables

hello
cant find any reference in google. will be thankful for explanation

let valid1 = [1,2,3,4]
let valid2= [5,6,7,8]

const batch = [valid1, valid2]

console.log(batch[1]);

// expected return [ 5, 6, 7, 8 ]

i need expected return valid2 (name of the variable in batch array)
how to do this and where to read about this behaviour?
TY

out

edit: nvm, seemed like you were saying you were getting a different result because of your // expected result comment

Hi, so whats the solution to show variable name but not the array content?

If you don’t store the name you can’t get the name out, it’s not there.

Maybe you’d like to make an array of strings instead.

Ok, so is it possible to fetch variable names? Not the content.

You can’t fetch something that doesn’t exist

If you want to get strings from your array then you’d have to put strings in your array

Great, can u explaine more about this.

Let me know if i got u correctly.

If there is declared array with variables (in my example its batch), return of any element will result in variable’s content. But not the variable name.

Can u share any articles to read about this behaviour.

TY

That’s not special behaviour.
If you put a value in an array, you get a value in an array.

If you put 5 in an array, you’ll get [5]
There’s nothing else to it.