Skip to content

Instantly share code, notes, and snippets.

@tuckcodes
Created December 22, 2018 07:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuckcodes/9cffbb0d11370ba72ec6740606cf52fe to your computer and use it in GitHub Desktop.
Save tuckcodes/9cffbb0d11370ba72ec6740606cf52fe to your computer and use it in GitHub Desktop.
Rebuild the math.min method
// Min rebuild
// Rebuild the min function
function smallestNum(...numbersArray) {
lowestNumber = true;
numbersArray.forEach(number => {
if (lowestNumber == true) {
lowestNumber = number;
}
if (lowestNumber > number) {
lowestNumber = number
}
});
console.log("Currently the lowest number is " + lowestNumber); // for testing purposes
return lowestNumber // for production purposes
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment