| ▲ | Someone a day ago | |||||||
> Javascript uses UTF-16 for strings I don’t think the spec requires that. charAt indexes on UTF-16 code points, but I don’t remember ever seeing that it has to do that in O(1) time, so that doesn’t imply the implementation has to use UTF-16 internally. Also, for modern JavaScript, https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... says: “Note: Avoid re-implementing the solutions above using charAt(). The detection of lone surrogates and their pairing is complex, and built-in APIs may be more performant as they directly use the internal representation of the string. Install a polyfill for the APIs mentioned above if necessary.” Because of that, I would hope most modern implementations to at least have a variant internal representation that is similar to UTF-8. | ||||||||
| ▲ | kragen 19 hours ago | parent [-] | |||||||
I wouldn't expect them to. Let us know if you find otherwise! | ||||||||
| ||||||||