Basic Algorithm Scripting: Chunky Monkey: what is a two dimensional array?

Tell us what’s happening:
I read the instructions. I was not clear on what a two-dimensional array was. I searched and read a bit in the forums and googled it. However I am still not clear on what a two-dimensional array is.

What is a two dimensional array?

Your code so far


function chunkArrayInGroups(arr, size) {
return arr;
}

chunkArrayInGroups(["a", "b", "c", "d"], 2);

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Chunky Monkey

Link to the challenge:

An array that contains arrays.

const twoDimensionalArray = [
  ['foo', 'bar', 'baz'],
  ['lorem', 'ipsum', 'dolor']
];
1 Like

Thanks for that. Would the addition of ['owl,' 'bat'] in the second array (as I inserted it below) make it three-dimensional, or still only two-dimensional?

const twoDimensionalArray = [
[‘foo’, ‘bar’, ‘baz’],
[‘lorem’, ‘ipsum’, ‘dolor’, [‘owl,’ ‘bat’]
];

Only if you add the missing ] at the end of the 3rd line and move the comma outside of 'owl'.

const twoDimensionalArray = [
  ['foo', 'bar' 'baz'],
  ['lorem', 'ipsum', 'dolor', ['owl', 'bat']]
];

ok got it, thanks @RandellDawson!