JSFiddle - React, Tailwind, and code Playground
by smacky311
JavaScript
if(typeof Object.create !== 'function') {
Object.create = function(o) {
var F = function() {};
F.prototype = o;
return new F();
};
}
var myMammal = {
name: 'Herb the Mammal',
get_name:function() {
return this.name;
} ,
says: function() {
return this.saying || '';
}
};
var myCat = Object.create(myMammal);
myCat.saying = 'meow';//object is augmented with new property
document.writeln(myCat.saying);
//document.writeln(true && false);