JSFiddle - React, Tailwind, and code Playground

by Walter Rumsby

HTML

<ul id="output"></ul>

CSS

#output {
    color: red;
    font-weight: bold;
}

JavaScript

var Foo = (function () {
    'use strict';
    
    var hidden;
    
    function Factory (options) {
        hidden = options.hidden;
    }
    
    Factory.prototype.hidden = function () {
        return hidden;
    }
    
    return Factory;
}());

var a = new Foo({
    hidden: 'a'
});

var b = new Foo({
    hidden: 'b'
});

function assert (expression, message) {
    var el = document.getElementById('output');

    if (!expression) {
        el.innerHTML += '<li>' + (message || 'boo') + '</li>';
    }
}

assert(a.hidden() === 'a', 'a.hidden() should be "a"');
assert(b.hidden() === 'b', 'b.hidden() should be "b"');