The prototype method is accessible to each other (call) of
Method prototype, can visit each other, call each other
<!DOCTYPE html> <html lang="en"> < Head > < Meta charset = "UTF-. 8" > < title > title </ title > < Script > // Method prototype, is accessible to each other function Animal (name, Age) { the this .name = name; the this .age = Age; } // add prototype method Animal.prototype.eat = function () { console.log ( " eat bamboo " ); the this .play (); }; Animal.prototype.play = function () { console.log("玩球"); this.sleep(); } Animal.prototype.sleep = function () { console.log ( " sleep " ); } // instantiates and initializes var Panda = new new Animal ( " daughter " , 9 ); panda.eat (); // call the method // Method prototype object, you can call each </ Script > </ head > <body> </body> </html>