Object.create实现继承

Object.create实现继承

var Parent = function(){
	this.name = 'parent'
};
Parent.prototype.n = '001';


var Child = function(){
	Parent.call(this)
};
//继承
Child.prototype = Object.create(Parent.prototype);

var _c = new Child();

_c.name;//调用构造方法
_c.n;//调用原型方法