Reputation: 890
I'm sure this is a simple one - But I'm learning Javascript and executing programs through Node.js
function sumAll(arr) {
var max = Math.max(...arr);
console.log(max);
}
sumAll([1, 4]);
The error I have is:
SyntaxError: Unexpected token ...
I assume this is down to the ES6 spread operator? Is this not valid?
I have also tried to add the following, based on other StackOverflow answers I've found:
"use strict";
But this doesn't work either.
Any help appreciated - Thanks
Upvotes: 1
Views: 415
Reputation: 1241
Might be you are using outdated node.js version. Try to update your node.js with v6.10 or later on the latest version.
Upvotes: -1
Reputation: 2879
Seems that you use outdated node.js version. Try to update your node.js to the latest version.
Upvotes: 4