`String.prototype.symbolAt()` (improved `String.prototype.charAt()`)

André Bargull andre.bargull at udo.edu
Fri Oct 18 09:17:30 PDT 2013


> >/  I disagree. In those situations you should just iterate over the string using `for...of`.
> /
> That seems to iterate over code units as far as I can tell.
>
>    for (var x of "?")
>      print(x.charCodeAt(0))
>
> invokes print() twice in Gecko.

SpiderMonkey does not implement the (yet to be) spec'ed 
String.prototype.@@iterator function, instead it simply aliases 
String.prototype["@@iterator"] to Array.prototype["@@iterator"]:

js> String.prototype["@@iterator"] === Array.prototype["@@iterator"]
true


- André
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131018/ba49c35b/attachment-0001.html>


More information about the es-discuss mailing list