SOURCE

function Person(name, age) {
  this.name = name;
  this.age = age;
}

Person.prototype.say = function() {
  console.log(this.name);
}

function Tom(name, age) {
  Person.apply(this, arguments)
}
function extend (object, superClass) {
  var F = function () {}
  F.prototype = superClass.prototype;
  F.prototype.constructor = F;
  object.prototype = F.prototype;
  object.prototype.constructor = object;
}
//Tom.prototype = Object.create(Person.prototype);
extend(Tom, Person);
var tom1 = new Tom('ngnice', 10);
tom1.say();
console.log(tom1) ;
console.log(tom1 instanceof Tom);
console.log(tom1 instanceof Person);
console 命令行工具 X clear

                    
>
console