Mercurial > web-gnusto
changeset 44:c628beacc40d
Found a much easier way of getting the last character of a string.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 15 May 2008 23:46:19 -0700 |
parents | e45b81cdb4d0 |
children | b878753fd3b9 |
files | trivial-zui.js |
diffstat | 1 files changed, 1 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/trivial-zui.js Thu May 15 23:42:23 2008 -0700 +++ b/trivial-zui.js Thu May 15 23:46:19 2008 -0700 @@ -49,9 +49,7 @@ if (event.charCode) { var newChar = String.fromCharCode(event.charCode); - var lastChar = self._inputString.charAt( - self._inputString.length - 1 - ); + var lastChar = self._inputString.slice(-1); if (!(newChar == " " && lastChar == " ")) { self._inputString += newChar; }