Skip to content

Instantly share code, notes, and snippets.

@jonasporto
Created December 14, 2016 19:07
Show Gist options
  • Save jonasporto/c3a0286b7f09809f637857ab20dfbfec to your computer and use it in GitHub Desktop.
Save jonasporto/c3a0286b7f09809f637857ab20dfbfec to your computer and use it in GitHub Desktop.

./lib/enum.js

module.exports = Object.freeze({
    IS_A_THING: 1,
    IS_ANOTHER_THING: 2
});

./lib/main.js

var myEnum = require('./enum');

console.log(myEnum.IS_A_THING); // 1

myEnum.IS_ANOTHER_THING = 'trying update a constant';

console.log(myEnum.IS_ANOTHER_THING); // 2```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment