JavaScript with Arrays - Splitting & Joining arrays