JSFiddle - React, Tailwind, and code Playground
JavaScript
Object.prototype.clone = function() {
var f = function () {};
f.prototype = this;
var g = new f();
g.prototype = this;
return g;
}
var man = { name: "asdf", age: 21, sayHello: function () { alert("Hello, World!!!"); } };
var me = man.clone();
man.age = 40;
man.sayHello = function () { alert("By, World!!!"); }
alert(me.name + " is " + me.age + " year old!");
me.sayHello();
alert(man.name + " is " + man.age + " year old!");
man.sayHello();