This idea comes from a rather ASCII-centric perspective upon strings and will definitely break multi-byte characters. And even if it wouldn't, your intent might have been to do just that.
Long story short, it's debatable what exactly you want to iterate in a string,
hence such a method would lead to pretty bad practice and should therefore not
be added to the language.
On Thursday, May 17, 2018 5:16:03 PM CEST Ben Fletcher wrote:
> Consider adding the array .map() implementation directly to the String
> prototype.
>
> Here is a possible polyfill:
>
> String.prototype.map = function (fn) {
> return Array.prototype.map
> .call(this, fn)
> .join('');
> }
>
> This replaces the common pattern of splitting, mapping, joining strings for
> processing. _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

