Modify An Array In Place Javascript Substring Until Character