Search code examples
javascriptsyntax-errorreserved-words

Chrome error: 'unknown message reserved_word' on JavaScript enum declaration


enum ButtonType { Autowoot, Autoqueue }

Is causing Google Chrome's developer tools to give me this error:

Uncaught SyntaxError: <unknown message reserved_word>

I read that you can create enumerations like that from here, but my script doesn't run because of this error here. I'm doing exactly what that person who answered the question wrote, and it doesn't function. Any ideas?

Thanks!


Solution

  • You need to do something like:

    var ButtonType = {
      'Autowoot' : 0,
      'Autoqueue' : 1
    };
    

    The enum syntax enum ButtonType { Autowoot, Autoqueue } is not supported currently.