yep
agreed...that's not enough reason (I just added that might be "the reason
for...").

Cheers.

[ ]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 Mon, Mar 19, 2018 at 5:38 AM, Claude Pache <claude.pa...@gmail.com>
wrote:

>
>
> >
> > The only reason I would defend the "reverse" method in strings is
> because it makes sense.
> > I think JavaScript is very intuitive, and, as Arrays do have the
> "reverse" method, that simply makes sense to have it in strings as well.
> >
>
> ”Making sense” and ”symmetry of API” is not a sufficient reason, because a
> string is not ”just” an immutable array of chars. Consider:
>
> 1. Some methods defined on arrays only: `find`, `reduce`, `reverse`
> 2. Some methods defined on strings only: `repeat`, `startsWith`
> 3. Some methods defined on both arrays and strings with same semantics:
> `concat`, `slice`
> 4. Some methods defined on both arrays and strings with different
> semantics: `includes`, `indexOf`
>
> Existence of methods listed in (1), (2) and (4) is a consequence of
> strings and arrays having different needs.
>
> —Claude
>
>
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to