JSFiddle - React, Tailwind, and code Playground

by Hollister Williams

HTML

<div id='output1'></div>
<div id='output2'></div>

JavaScript

var foo = function() {
    var that = {
        a: 7,
        b: 6
    };
    that.c = that.a + that.b;
 
  return that;
}();    // notice that this line executes foo

foo;    // foo can be used without an instantiation call
document.getElementById('output1').innerText = foo.c; //13
foo.c = 14;    // c is writable
document.getElementById('output2').innerText = foo.c; //14