I am a C ++ programmer (not very good), and I know what enum is. When I was reading about lexical grammar (Source MDN), I saw a new keyword, enum. I tried it on NodeJS. And it works! (Well yes, but actually no ...).
enum someEnum {
}
And NodeJS throws an error...
SyntaxError: Unexpected reserved word
←[90m at wrapSafe (internal/modules/cjs/loader.js:1060:16)←[39m
←[90m at Module._compile (internal/modules/cjs/loader.js:1108:27)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:993:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:892:14)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)←[39m
←[90m at internal/main/run_main_module.js:17:47←[39m
But look! NodeJS considers it a keyword. The question is, is there a right way?
enumdoesn't do anything currently. It's just a reserved keyword for the futuer.