Does anyone see anything wrong with this code??? Any help is appreciated!
function largestOfFour(arr, finalArr = []) {
return !arr.length
? finalArr
: largestOfFour(arr.slice(), finalArr.concat(Math.max(...arr[0])))
}
Does anyone see anything wrong with this code??? Any help is appreciated!
function largestOfFour(arr, finalArr = []) {
return !arr.length
? finalArr
: largestOfFour(arr.slice(), finalArr.concat(Math.max(...arr[0])))
}
you just need to add 1 like that ====> arr.slice(1)
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.