JSFiddle - React, Tailwind, and code Playground

by Marco Iamonte

JavaScript

// a is a SELF-EXECECUTING-ANONYMOUS-FUNCTION!

var a = (function(){
    var c = 0;
    
    return {
        get: function() {
            return c;
        },
        set: function(val) {
            c = val;   
        },
        decrease: function(val) {
            c -= val;
        }
    };
}());

a.set(10);
a.decrease(5);

alert(a.get());