Alternate definition
suggest changeObject.freeze() has been available since ECMAScript 5. Where it is unavailable, a plain object can stand in for an enum. Unlike Object.freeze(), this object can still be changed:
const ColorsEnum = {
WHITE: 0,
GRAY: 1,
BLACK: 2
}
// Define a variable with a value from the enum
const currentColor = ColorsEnum.GRAY;
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents