Skip to content

Instantly share code, notes, and snippets.

@linx4200
Created March 17, 2018 12:32
Show Gist options
  • Save linx4200/e1b435bee766c81253c335c5fa4a83fa to your computer and use it in GitHub Desktop.
Save linx4200/e1b435bee766c81253c335c5fa4a83fa to your computer and use it in GitHub Desktop.
【继承】原型式继承
function inheritObject(o) {
// 声明一个过渡函数对象
function F () {};
// 过渡对象的原型继承父对象
F.prototype = o;
// 返回过渡对象的一个实例
return new F();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment