Constructor + Prototype

by nickxbs

JavaScript

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

Person.prototype.handshake = function(){
    console.log(this.name + " handshake");
}

var nicola = new Person('nicola');
nicola.handshake();
console.log(nicola.constructor);
console.log(nicola.constructor.prototype.handshake);