Skip to content

Instantly share code, notes, and snippets.

@amejiarosario
Created June 28, 2019 19:02
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 amejiarosario/baeccdbf773f127b91f07dd6b8a3acd0 to your computer and use it in GitHub Desktop.
Save amejiarosario/baeccdbf773f127b91f07dd6b8a3acd0 to your computer and use it in GitHub Desktop.
/**
* Get the smallest number on an array of numbers
* @param {Array} n array of numbers
*/
function getMin(n) {
const array = Array.from(n);
let min;
array.forEach(element => {
if(min === undefined || element < min) {
min = element;
}
});
return min;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment