Corrected question 245
const marks = [50, 20, 70, 60, 45, 30]; function findMin(arr) { return Math.min.apply(null, [...arr]); } function findMax(arr) { return Math.max.apply(null, [...arr]);
} console.log(findMin(marks)); console.log(findMax(marks));
You don't need to use spread operator for Math.min.apply and Math.max.apply
Maybe, but the code doesn't run as is, I just tried to go with your logic, while fixing the error. It was just a suggestion. Anyway thanks :)
Corrected question 245 #155
const marks = [50, 20, 70, 60, 45, 30]; function findMin(arr) { return Math.min.apply(null, [...arr]); } function findMax(arr) { return Math.max.apply(null, [...arr]);
} console.log(findMin(marks)); console.log(findMax(marks));