Chunky Monkey (Question about an error statement)

Tell us what’s happening:
This is has less to do with the actual challenge and more with an error statement I’m receiving.

When I run the code below, the console responds with
arr.split is not a function
Why is it saying this? What am I doing that would make it say this? I don’t understand how my code causes an array method to be viewed as a function.

Your code so far


function chunkArrayInGroups(arr, size) {
 var arrMap = arr.split(" ");
 console.log(arrMap);
  return arr;
}

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

//split an array
//split must contain a number of groups equal to number indicated in variable size

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36.

Link to the challenge:

It’s because arrays don’t have a split method. Strings do, though.

2 Likes