> 
> 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
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to