JSFiddle - React, Tailwind, and code Playground
JavaScript
// Create a constructor
function A() {}
// Add a prototype property
A.prototype.name = "Freddy";
// Create two object instances from
// the constructor
var a = new A();
var b = new A();
// Both instances have the property
// that we created on the prototype
console.log("A1", a.name); // Freddy
console.log("A2", b.name); // Freddy
// Now change the property on the
// prototype
A.prototype.name = "George";
// Both instances inherit the change.
// Really they are just reading the
// same property from the prototype
// rather than their own property
console.log("B1", a.name); // George
console.log("B2", b.name); // George
console.log("C", a.hasOwnProperty("name")); // false
b.name = "Chris";
console.log("D", b.hasOwnProperty("name")); // true
console.log("E1", a.name); // George
console.log("E2", b.name); // Chris
delete b.name;
console.log("F", b.hasOwnProperty("name")); // false
console.log("G", b.name); // George