<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>对象间的原型关系02</title> </head> <body> </body> </html>
var proto = { description:function(){ return 'My name is '+ this.fullname +', I\'m a '+this.sex } } var john = { __proto__:proto, fullname : 'johnhery', sex:'boy' } console.log(john.description());