JSFiddle - React, Tailwind, and code Playground

by nickxbs

JavaScript

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

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

function Worker(){	
}

Worker.prototype = new Person();

var nicolaWorker = new Worker('nicola');
var nicolaPerson = new Person('nicola');
nicolaWorker.handshake();