Skip to content

Instantly share code, notes, and snippets.

@erhanyasar
Last active Jun 15, 2020
Embed
What would you like to do?
const solution = (numbers) => {
let maxNumber = 0;
for (let i=0; i<numbers.length; i++){
if (numbers.length < 1)
return maxNumber;
if (numbers[i] > maxNumber)
maxNumber = numbers[i];
}
return maxNumber;
};
console.log(solution([1,2,3,4,5,6]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment