Created
August 24, 2022 18:08
-
-
Save thawkin3/f6c329a5ee3268cfe95c287d1ca46150 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const maxNumberArray = (numbers) => { | |
if (numbers.length <= 1) { | |
return numbers[0]; | |
} | |
const numberA = numbers[0]; | |
const numberB = maxNumberArray(numbers.slice(1)); | |
return numberA > numberB ? numberA : numberB; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment