My use case is solving coding tasks about palindromes on codefights.com. Not sure if that counts as "real-world", but probably a lot of beginning developers encounter such tasks at least once.



On Sun, 18 Mar 2018 06:41:46 +0700, Mathias Bynens <[email protected]> wrote:

So far no one has provided a real-world use case.

On Mar 18, 2018 10:15, "Mike Samuel" <[email protected]> wrote:
Previous discussion: https://esdiscuss.org/topic/wiki-updates-for-string-number-and-math->>libraries#content-1

"""
String.prototype.reverse(), as proposed, corrupts supplementary characters. >>Clause 6 of Ecma-262 redefines the word "character" as "a 16-bit unsigned >>value used to represent a single 16-bit unit of text", that is, a UTF-16 code >>unit. In contrast, the phrase "Unicode character" is used for Unicode code >>points. For reverse(), this means that the proposed spec will reverse the >>sequence of the two UTF-16 code units representing a supplementary >>character, resulting in corruption. If this function is really needed (is it? for >>what?), it should preserve the order of surrogate pairs, as does >>java.lang.StringBuilder.reverse:download.oracle.com/javase/7/docs/api/>>java/lang/StringBuilder.html#reverse()
"""

On Sat, Mar 17, 2018 at 1:41 PM, Grigory Hatsevich <[email protected]> wrote:
Hi! I would propose to add reverse() method to strings. Something
equivalent to the following:

String.prototype.reverse = function(){
     return this.split('').reverse().join('')
}

It seems natural to have such method. Why not?


_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to