get last character of string javascript