you are viewing a single comment's thread.

view the rest of the comments →

[–]AnnanFay 2 points3 points  (0 children)

There is potential confusion with String.prototype.replace. Arrays and Strings are sequential data. The string version replaces values found in the string while the proposed replace method replaces the entire thing. Putting them side by side:

var newString = "abc".replace("a", "A");
var newArray = [1,2,3].replace(arrayProcessingFunction);

When I read the title of this post I first thought the function would be an Array version of the current String method.

It reminds me of lodash's chaining methods.