Reputation: 115
I'v tried this code in Node.js v6.3.1 Cli
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
console.log(x); // 1
console.log(y); // 2
console.log(z); // { a: 3, b: 4 }
and it prints like this
SyntaxError: Unexpected token ...
i'm burned out while i'm tring to find out Why. help me!
Upvotes: 1
Views: 779
Reputation: 30330
Node 6 (or any other current Node version) does not support that syntax.
The Object rest/spread proposal is at Stage 3 in TC39's process for adding new features. That means it is almost, but not quite ready to be added to the ECMAScript spec.
More information about the TC39 stage system for ECMAScript.
Upvotes: 3