JSFiddle - React, Tailwind, and code Playground

by Rishabh Sharma

JavaScript

class A {
	constructor(bar) {
  	this.bar = bar;
  }
  
  printMe() {
  	console.log(this.bar);
  }
}

var a1 = new A('bar');
var a2 = new A('bam');

a1.printMe();
a2.printMe();

// what if I do this -
Object.setPrototypeOf(a1, {});

console.log(a1.printMe());

// how would you test that a1 and a1 share the same prototype object?