Javascipt: Split big arrays to smaller