It my first post, i have some troubles with one javascript tutorial tasks. Yes i did research ;) Task is: 1. Generate array with 10 random numbers. 2. Make a function where aray will be argument 3. Function should return smallest number from array
I did something that works but i dont know how to connect second part in one function. Thanks in advance!
var tab = []
for (var i=0; i<10; i++) {
var random = Math.floor(Math.random() * 59 + 1);
tab.push (random);
}
function getMinFromTab(a,b) {
return a - b;
}
tab.sort(getMinFromTab);
getMinFromTab(tab);
console.log(tab[0]);