2

This a weird behaviour, i've tested on Chrome and works just fine without any flag, but in node it doesn't work event with the latest version

$ node --harmony_destructuring app.js

[length, offset] = this.getint(data, offset, 2)
^    
ReferenceError: Invalid left-hand side in assignment

$ node -v

v5.11.0

Any clues on why it doesn't work or a version of node in witch works?

Thanks

Bergi
  • 630,263
  • 148
  • 957
  • 1,375
norman784
  • 2,201
  • 3
  • 24
  • 31

1 Answers1

3

The correct syntax would be

const iterable = ['a', 'b'];
const [x, y] = iterable;

You can read more on destructuring here.