Issue
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.
Solution
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.
Answered By - Vencovsky Answer Checked By - Willingham (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.