Skip to content

Instantly share code, notes, and snippets.

@erhanyasar
Last active June 15, 2020 10:03
Show Gist options
  • Save erhanyasar/63759ad767d1fa5550fb7eb6d6d10a81 to your computer and use it in GitHub Desktop.
Save erhanyasar/63759ad767d1fa5550fb7eb6d6d10a81 to your computer and use it in GitHub Desktop.
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