Fits the number passed as a parameter in an interval from 0 to 10
Fits the number passed as a parameter in an interval from 0 to 10
by Akram kamal
JavaScript
function whatDoesItDo(num) {
return Math.max(0,Math.min(10,num));
}
console.log(whatDoesItDo(-9)); // anything <= 0 return the min 0
console.log(whatDoesItDo(10)); // anything >= 10 return the max 10