0

I have a function like that:

const exec = data => {
  let list, file;

  switch (data.action) {
    case A:
      { list } = getList(data);
      break;

    case B:
      { list } = getList(data);
      break;
  }
}

Node tells me:

SyntaxError: Unexpected token =

But as documented here (Section »Assignment separate from declaration«)

A variable can be assigned its value via destructuring separate from the variable's declaration.

So, am I doing something wrong here, or is that a part of the ES6 spec, which node does not implement as documented?

philipp
  • 15,947
  • 15
  • 61
  • 106

0 Answers0