JSFiddle - React, Tailwind, and code Playground

by JOEHOELLER

HTML

<form method="" action="">
    <fieldset>
        <input type="number" id="topNum" />
        <input type="number" id="btmNum" />
    </fieldset>
</form>

JavaScript

//i create a var thats an empty function

var Class = function(){};

//then i give that var a property
Class.prototype.addOne = function(){ document.getElementById.value++; };

//next i create new function and what makes them unique children is the var name
var inst1 = new Class();
var inst2 = new Class();

// setters
inst1.value = 0;
inst2.value = 3;

//inheirit the core property of Class and extending upon it with whatevevr the child does
inst1.addOne();


//output its value
console.log(inst1.value+" | "+inst2.value);