As told in the Douglas JavaScript good parts, I tried to create a array method as below,
Array.method('reduce', function (f, value) {
});
but I am getting
Uncaught TypeError: Array.method is not a function at :1:7
You need to read the section titled "A Simple Testing Ground" on page 20:
Throughout the book, a method method is used to define new methods. This is its definition:
Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; };It will be explained in Chapter 4.