JSFiddle - React, Tailwind, and code Playground

by cuzzea

JavaScript

Function.prototype.className = function(){
    console.log(this.constructor.toString());
    return '';//(/(\w+)\(/.exec(this.constructor.toString())[1])
};
Function.prototype.implements = function(interface){
    for(var i in interface){
        if(i in this) continue;
        else console.log("This class ('%s') dose not implement '%s'",this,i);
    }
};

var Interface;
function Interface(methods){
    console.log(methods)
    for(var i in methods){
        this[i] = methods[i];
    }
}

var Cls;
function Cls(){
    // public vars
    this.a = 1;
    this.b = 2;
    // private vars
    var c = 3,
        d = 4;
    // priviliaged methods
    this.e = function(){};
    this.f = function(){};
    // private methods
    var g = function(){},
        h = function(){};
    console.log(this)
    return this;
}
// public var
Cls.prototype.i = 5;
Cls.prototype.j = 6;
// public methods
Cls.prototype.k = function(){};
Cls.prototype.l = function(){};
// class constants
Cls.m = 7;
Cls.n = 8;
// class methods
Cls.o = function(){};
Cls.p = function(){};

new Cls().implements({a:'',s:''});