How to group subsequent objects of an array in Javascript

visit shbcf.ru