JSFiddle - React, Tailwind, and code Playground

HTML

<div id="output"></div>

JavaScript

// Define an Enum function for the base Object class
Object.defineProperty(Object.prototype,'Enum', {
	value: function() {
		for(i in arguments) {
			Object.defineProperty(this,arguments[i], {
				value:parseInt(i),
				writable:false,
				enumerable:true,
				configurable:true
			});
		}
	},
	writable:false,
	enumerable:false,
	configurable:false
}); 

// make an object
var eCOLORS={};
// call Enum on that object with the listed members
eCOLORS.Enum('RED','GREEN','BLUE');

var o=document.getElementById("output");

// test output via iteration
for(e in eCOLORS) {
    o.innerHTML += e + " = " + eCOLORS[e] + "<br>";
}

o.innerHTML+="<br>Attempting to change values...<br><br>";

// Attempt to change the values
eCOLORS.RED = 10;
eCOLORS.GREEN = 11;
eCOLORS.BLUE = 12;

// output the "new" values... notice there's no change
for(e in eCOLORS) {
    o.innerHTML += e + " = " + eCOLORS[e] + "<br>";
}