Answers for "javascript string prototype"

2

javascript string prototype

/* String prototype all built-in methods:
 * developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
 * -------------------------------------------------------------------------
 */

// Example for *extending* the String prototype
String.prototype.reduce = function () { 
    return this.split().reduce(...arguments);
}
Posted by: Guest on June-02-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language