whteout — 2011-07-21T07:40:14-04:00 — #1
is this correct
var mid = math.floor((0 + array.length)/2)
from here you could use array.slice to divide the array into two equal sized arrays?
paul_wilkins — 2011-07-21T07:53:05-04:00 — #2
That would be possible if you have an even length array, but dividing an odd-sized array in to two equal sized arrays could be a challenge.
guido2004 — 2011-07-21T07:53:35-04:00 — #3
Did you try?
You can divide the array in two equal sized arrays if the array contains an even number of elements. If it's uneven, one part will have one element more than the other part.
guido2004 — 2011-07-21T07:54:52-04:00 — #4
You just beat me to it
paul_wilkins — 2011-07-21T07:55:26-04:00 — #5
Great minds, eh?
whteout — 2011-07-21T23:46:05-04:00 — #6
OK so now that I have the middle figured, how can I split the array into two arrays?
paul_wilkins — 2011-07-22T00:02:03-04:00 — #7
I'd say that the .splice() method would be the best way to do that.