JSFiddle - React, Tailwind, and code Playground

by WilsonPage

HTML

<div></div>

JavaScript

/***************************************************
** DEFINITION
***************************************************/

// define the class
var TheClass = (function(param) {
    this.a = param;
});


// define a method that can be run on this class
TheClass.prototype.TheMethod = function(multiply) {
    this.b = this.a * multiply;
}


    
/***************************************************
** USAGE
***************************************************/    
    
// create a new instance of this class
var MyClass = new TheClass(14);


// run the method which is attached to this class
MyClass.TheMethod(2);


// log out result    
console.log(MyClass);