Seyoon
Seyoon

Reputation: 115

Does Node.js 6.3.1 NOT supports object rest/spread properties?

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

result

SyntaxError: Unexpected token ...

i'm burned out while i'm tring to find out Why. help me!

Upvotes: 1

Views: 779

Answers (2)

Dakota Murphy
Dakota Murphy

Reputation: 21

Node 8.3.0 now supports Object rest/spread

Upvotes: 2

joews
joews

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

Related Questions