Instance Of Tests

by andypotanin

JavaScript

function Thing() { return this; }
Thing.prototype.test = function() {}

var Instance1 = new Thing;
var Instance2 = Object.create( new Thing, { 'item': {} });
var Instance3 = Object.create( Thing.prototype, { 'item': {} });

console.clear();
console.log( Instance1 instanceof Thing );
console.log( Instance2 instanceof Thing );
console.log( Instance3 instanceof Thing );