Partitioning and Mapping Array in JavaScript - Effect Community