Object.create

Object.create = Object.create || function (proto) {

  var F = new function () {}

  F.prototype = proto;

  return new F();

}

 

subtype.prototype = Object.create(supertype.prototype);

 

 

this
跟别的语言大相径庭的是,JavaScript 的 this 总是指向一个对象,而具体指向哪个对象是在

运行时基于函数的执行环境动态绑定的,而非函数被声明时的环境。
posted @ 2016-05-05 10:58  杨博客  阅读(92)  评论(0编辑  收藏  举报