2016-08-06 17 views

Antwort

1

Es gibt keine method() in der Array. In Douglas Crockford Beiträge, er hat diese Methode selbst erstellt und dann verwendet es.

Dies ist der Code

Object.prototype.method = function (name, func) { 
    this.prototype[name] = func; 
    return this; 
}; 
1

Sie benötigen 20 den Abschnitt mit dem Titel "A Simple Testing Ground" auf Seite zu lesen:

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.