I'm looking to find a way to split an array into a set number of chunks. I've seen multiple posts on here which split it into chunks with a specified length, but that's not what I'm after. For example, consider the following array:
var array = ['1','2','3','4','5','6']
I would like to easily be able to pass this to a function such as the following
splitArray(array, 2)
Which would result in the following:
[[1,2,3], [4,5,6]]
Edit: As i mentioned, I wasnt to evenly split an array into a set number of chunks, not a number of chunks with a specified length as other questions ask