javascript split string by last character