[javascript] how to get the last character of a string?