Off topic but how would i deal with this?


#1

Hi guys,

I know this might be out of the question but i need your help. how would i access a number inside an array which is inside of an array?.
this is what i mean.

function openOrSenior(data){

console.log(data[]);
}
//How would i access just the number 20 and log that into a console for example?
openOrSenior([[18, 20],[45, 2],[61, 12],[37, 6]]);

Thank you for your help much appreciated.
This is a little program i'm working on.


#2

An array in an array is called a row. Each array has its own index, so to access an internal array, we would use both indices.

myArray = [
    [ 1, 2, 3, 4 ],
    [ 5, 6, 7, 8 ],
    [ 9, 10, 11, 12 ]
];

console.log(myArray[1][3]);    // 8

#3

Thanks for you help i know it now.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.