JSFiddle - React, Tailwind, and code Playground

by Hui Zheng

JavaScript

function F1() { }

var obj = new F1();
console.assert(obj.constructor == F1);
console.assert(obj.constructor.prototype == F1.prototype); // != Object.prototype
console.assert(Object.getPrototypeOf(obj) == F1.prototype);

////////// override prototype

function F2() { }
F2.prototype = {
   foo: "bar"
};

var obj = new F2();
console.assert(obj.constructor == Object); // != F2
console.assert(obj.constructor.prototype == Object.prototype);
console.assert(Object.getPrototypeOf(obj) == F2.prototype);