JSFiddle - React, Tailwind, and code Playground

by mmansion

JavaScript

// The .bind method from Prototype.js 
if (!Function.prototype.bind) { // check if native implementation available
  Function.prototype.bind = function(){ 
    var fn = this, args = Array.prototype.slice.call(arguments),
        object = args.shift(); 
    return function(){ 
      return fn.apply(object, 
        args.concat(Array.prototype.slice.call(arguments))); 
    }; 
  };
}

var MyClass = function() {
    var self = this;
    
    self.myPublicMethod = function() {
          
    }
};

MyClass.prototype = {

    myPrototypeMethod: function() {
        
       console.log(self);

    }
}


var c = new MyClass();

c.myPrototypeMethod();