JSFiddle - React, Tailwind, and code Playground

by BrownieBoy

HTML

<input type="button" onclick="doAction();" value="doAction()"><br>
<br>
<br>

<input name="TestField" value="" id="TestField"></form>

JavaScript

if (typeof Object.create !== 'function') {
    Object.create = function (o) {
        function F() {}
        F.prototype = o;
        return new F();
    };
}

function doAction() {
    var protoObj = {
        hello: function() {
            alert('hi');
        },
        goodbye: function() {
            alert('bye');
        }
    };


    protoObj.goodbye();
    var myObj = Object.create(protoObj);    
    
    
 //   myObj.prototype = protoObj;
// newObject = Object.create(oldObject);
    
    
    myObj.goodbye();


}