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