Please ignore my previous email; it has been answered already. (It was a draft I wrote up this morning before I lost my internet connection.)
On 18 Oct 2013, at 11:57, Allen Wirfs-Brock <[email protected]> wrote: > Given that we have charAt, charCodeAt and codePointAt, I think the most > appropiate name for such a method would be 'at': > 'π'.at(0) Love it! > The issue when this sort of method has been discussed in the past has been > what to do when you index at a trailing surrogate possition: > > 'π'.at(1) > > do you still get 'π' or do you get the equivalent of > String.fromCharCode('π'[1]) ? In my proposal it would return the equivalent of `String.fromCharCode('π'[1])`. I think thatβs the most sane behavior in that case. This also mimics the way `String.codePointAt` works in such a case. Hereβs a prollyfill for `String.prototype.at` based on my earlier proposal: https://github.com/mathiasbynens/String.prototype.at Tests: https://github.com/mathiasbynens/String.prototype.at/blob/master/tests/tests.js _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

