In Basic Algorithm Scripting: Return Largest Numbers in ArraysPassed I decided to implement the map method in combination with the spread syntax. The answer is correct but the suggested solution is using map() in combination with Function.prototype.apply.bind. Since my solution is cleaner I wonder if there is any catch by using spread syntax instead.
// FCC solution
function largestOfFour(arr) {
return arr.map(Function.apply.bind(Math.max, null));
}
// my solution
function largestOfFour(arr) {
return arr.map(item => Math.max(...item));
}