Other than for amusement or programming challenge I've never found a use for it? Do you have one?
On Sat, Mar 17, 2018 at 4:11 PM, Felipe Nascimento de Moura < felipenmo...@gmail.com> wrote: > I would use `Array.from`: > > ``` > str = "a_\uD83D\uDE80_b" > Array.from(str).reverse().join('') > ``` > > But I also upvote the idea of having a reverse method in strings :) > > If `reverse` might cause some retrocompatibility problem (although I don't > think it requires params, what would pretty much avoid different > implementations as the method itself is very straight forwards), we could > go for `reverseText` or `reverseContent`. > > .o/ > > > > [ ]s > > *--* > > *Felipe N. Moura* > Web Developer, Google Developer Expert > <https://developers.google.com/experts/people/felipe-moura>, Founder of > BrazilJS <https://braziljs.org/> and Nasc <http://nasc.io/>. > > Website: http://felipenmoura.com / http://nasc.io/ > Twitter: @felipenmoura <http://twitter.com/felipenmoura> > Facebook: http://fb.com/felipenmoura > LinkedIn: http://goo.gl/qGmq > --------------------------------- > *Changing the world* is the least I expect from myself! > > On Sat, Mar 17, 2018 at 4:48 PM, Thomas Grainger <tagr...@gmail.com> > wrote: > >> String.prototype.reverse() might break web compatibility, how about >> String.prototype.turnyRoundy()? >> >> On 17 Mar 2018 18:47, "Claude Pache" <claude.pa...@gmail.com> wrote: >> >>> >>> >>> Le 17 mars 2018 à 19:29, Oriol _ <oriol-bugzi...@hotmail.com> a écrit : >>> >>> Be aware your code breaks pair surrogates, which might be undesirable: >>> >>> ```js >>> var str = "a_\uD83D\uDE80_b"; >>> str.split("").reverse().join(""); // "b_\uDE80\uD83D_a" :( >>> [...str].reverse().join(""); // "b_\uD83D\uDE80_a" :) >>> ``` >>> >>> —Oriol >>> >>> >>> Well, but be aware that the corrected implementation still breaks >>> graphemes composed by a sequence of code points, such as: n̈ ( LATIN SMALL >>> LETTER N + COMBINING DIEARESIS), which might be undesirable... >>> >>> Anyway, what are the use cases? >>> >>> —Claude >>> >>> >>> _______________________________________________ >>> es-discuss mailing list >>> es-discuss@mozilla.org >>> https://mail.mozilla.org/listinfo/es-discuss >>> >>> >> _______________________________________________ >> es-discuss mailing list >> es-discuss@mozilla.org >> https://mail.mozilla.org/listinfo/es-discuss >> >> > > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss > >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss