JSFiddle - React, Tailwind, and code Playground

HTML

<dl id="fd"><dt>Initial Assignment</dt>

</dl>
<dl id="sd"><dt>After Value Change Attempt</dt>

</dl>
<dl id="td"><dt>After Adding More Enums</dt>

</dl>

CSS

dt {
    font-weight: bold;
}
dd {
    font-family:"Courier New", courier, monospaced;
    font-size: 0.9em;
}

JavaScript

/**
 * Define method on Object.prototype.
 * Enum : declares type-safe properties on the active object, applies int value
 * 			for each argument starting at 0 and incrementing by 1 for each.
 * Does not set 'undefined', null, or empty string(''), but will still increment
 * Accepts a number insert, to offset the value
 * Example: obj.Enum('YELLOW',null,'','RED,'BLUE',10,'GREEN');
 * obj.YELLOW == 0
 * obj.RED == 3
 * obj.BLUE == 4
 * obj.GREEN == 11
 * This should be compliant in:
 * 		IE 9 +
 * 		FF 4 +
 * 		Chrome 5 +
 * 		Opera 11.60 +
 * 		Safari 5.1 +
 */
var odp = Object.defineProperty;
odp(Object.prototype, 'Enum', {
    value: function () {
        var ignore = [undefined, null, ''],
            n = 0,
            args = arguments;
        for (var i in args) {
            /* If value is in ignore list, skip assignment and increment counter */
            if (ignore.indexOf(args[i]) < 0) {
                /* If value is a number of greater value than counter, set counter to that value
                 * and proceed without assignment */
                if (typeof args[i] == "number") {
                    n = parseInt(args[i]);
                } else {
                    try {
                        odp(this, String(args[i]).toUpperCase().replace(/ /g, "_"), {
                            value: parseInt(n),
                            enumerable: true
                        });
                    } catch (e) {
                        console.warn(e.message);
                        n--;
                    }
                }
            }
            n++;
        }
        return this;
    }
});

/*
 * Testing function...
 */
function runTest() {
    var obj = {}, fd = document.getElementById("fd"),
        sd = document.getElementById("sd"),
        td = document.getElementById("td");
    /* enum our object, with a lowercase item as example */
    obj.Enum('YELLOW', null, '', 'red', 'BLUE', 10, 'GREEN');
    // add a non-enumeration variable to the...