4

I want to use:

class FOO extends
    // do stuff
    constructor() {
        //do stuff
    }
}
module.exports = FOO;

Output of nodejs --version = v0.12.7

Also running nodejs --harmony script.js is not accepting the classes.

I keep getting a:

class TODORouter extends
^^^^^
SyntaxError: Unexpected reserved word
Bob van Luijt
  • 7,153
  • 12
  • 58
  • 101
  • 3
    Your question may be answered here: http://stackoverflow.com/questions/27177485/node-js-es6-class-creation-syntaxerror-unexpected-reserved-word –  Aug 26 '15 at 11:23

1 Answers1

2

You may either use IO.js or run noe with the harmony flag, eg

node --harmony app.js

This might help: What does `node --harmony` do?

Community
  • 1
  • 1
woverton
  • 441
  • 1
  • 3
  • 12