Vasyl Demianiuk Vasyl Demianiuk - 15 days ago 8
Javascript Question

How to handle missing ) after argument list

Can't get a result from this function. Every time get error: missing ) after argument list.

function highAndLow(numbers) {
var Strings = numbers;
var newArr = Strings.split(' ');
var maxNum = Math.max.apply(null, newArr);
var minNum = Math.min.apply(null, newArr);
return maxNum + " " + minNum;


};

var top5 = highAndLow(4 3 1);
console.log(top5);

Answer

Pass them as as string! Seeing as you are using Strings.split()!

highAndLow("42 17 3");
Comments