Skip to content

SyntaxError: Unexpected reserved word #558

Closed
@sonicoder86

Description

@sonicoder86

Yesterday installed the new iojs version with nvm install iojs-v1.0.3 then wrote my first class definition. But for my disappointment i got the following error when tried to run a simple file:

/home/blacksonic/workspace/es6/class.js:3
class View {
^^^^^
SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:54:16)
    at Module._compile (module.js:429:25)
    at Object.Module._extensions..js (module.js:464:10)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)
    at Function.Module.runMain (module.js:487:10)
    at startup (node.js:111:16)
    at node.js:809:3

The content of the file:

"use strict";

class View {
    constructor(model) {
        this.model = model;
    }

    render() {
        console.log(this.model);
    }
}

var myView = new View({table: true});
myView.render();

I ran it with:
node --harmony es6/class.js
also tried it with

What i checked:

node -v
v1.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions