-1

I'm trying to create a simple model in nodejs but got the following error

var model = {​​​​​​​
                 ^

SyntaxError: Invalid or unexpected token
    at createScript (vm.js:80:10)

Model

function getAllSales(limit) {
    const sales = [];
    var model = {​​​​​​​
        "id": ​​"1",
        ​"​​​​​​products": ​​[{​
            "id": ​"​1",
            ​​"value": "​​10"​​
        }, ​​​ {​​
            "id": "​​2",
            "​​value": "​​20"
        }],
        "​​​​​​​total": ​​ "30.00",
        "date": "2017-10-02"
    };
    sales.push(model);

    return sales.slice(0, limit);
}
tadman
  • 208,517
  • 23
  • 234
  • 262
Lucas_Santos
  • 4,638
  • 17
  • 71
  • 118

1 Answers1

0

There's a ton of invisible characters there causing issues. Delete that var line, redo it, and you should be fine.

The specific character is 8203, a zero-width space, which is not valid JavaScript.

tadman
  • 208,517
  • 23
  • 234
  • 262