This is my code:
var array = process.argv.slice(2);
var min = Number.MIN_VALUE;
var max = Number.MAX_VALUE;
min = Math.min(...array);
max = Math.max(...array);
console.log("Maximum number is: ", max);
console.log("Minimum number is: ", min);
When I run it it errors:
min = Math.min(...array);
^^^
SyntaxError: Unexpected token ...
I'm using codio as my IDE.
CodePudding user response:
It's probably because of the node version is too old, try to update the node version.
It's working perfectly fine in my environment.
CodePudding user response:
Check you array and confirm it whether it really is an array.