How to split a string into an array using javascript