Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

largest element in nested array

function largestOfFour(arr, finalArr = []) {
  return !arr.length
    ? finalArr
    : largestOfFour(arr.slice(1), finalArr.concat(Math.max(...arr[0])))
}
Source by forum.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #largest #element #nested #array
ADD COMMENT
Topic
Name
8+8 =