Skip to content Skip to sidebar Skip to footer

Typeerror: Object Function Object() { [native Code] } Has No Method 'method'

Going through the example code for chapter 5.4 in Javascript: The Good Parts, the following is used to demonstrate the use of the functional pattern to call super methods: Object.m

Solution 1:

Douglas Crockford uses the following (defined on page 4 of the book)

Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    returnthis;
};

Solution 2:

That's because the method method is not defined in your code, check the book for a place where the author defined the method method.

Apparently @Andreas has found the method, and now I remember it.

The method method is used so that when it is called on any object, it defines a method on that object where the name of that method is the name parameter passed to method, and the implementation of that method is the func function parameter.

You need to include this in your console for things to work correctly.

Post a Comment for "Typeerror: Object Function Object() { [native Code] } Has No Method 'method'"