exploring splitting and joining arrays in JS