Split variable using a special character in JavaScript