Search code examples
javascriptstringecmascript-6reverseecmascript-2016

String reverse Built-in ES6


  • 10 implementations of String#reverse have been profiled according to each browser.

  • Those implementations have been explained since 2011.

  • When ES6 came , there are many code become more elegant & performance .

  • Concerning String reversing , I am wondered, if ES6 supports it .

  • Anyway, i end up with this syntax :

    reverse=(str)=>[...str].reverse().join('');
    

My question is :

Does ES6/ES7 has built-in API more elegant & brief & performance for that ?


Solution

  • Short answer: No.

    Reference: String object in the Mozilla Developer Network does not have any reverse() method.