I was trying to declare a variable named enum
but got Uncaught SyntaxError: Unexpected reserved word
error.
I'm not using typescript, so why is enum
a reserved keyword?
I was searching for it and realized that enum
is a reserved keyword, but protected
is also reserved and doesn't give me the error.
I also couldn't find what enum
is used for or how it works in vanilla js.
According to the docs
The following are reserved as future keywords by the ECMAScript specification. They have no special functionality at present, but they might at some future time, so they cannot be used as identifiers.
And enum
is always reserved keyword.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With