Temukan JavaScript yang paling umum
function smallestCommons(arr) {
var multiple = [];
arr.sort(function(a, b){
return a - b;
});
var range = (start, stop, step) => Array.from({ length: (stop - start) / step + 1}, (_, i) => start + (i * step));
multiple =range(arr[0], arr[1], 1)
let max = Math.max(...multiple)
const small = (current) => n % current === 0;
let n = max * (max - 1)
let common = false;
common = multiple.every(small)
while(common === false){
n++
common = multiple.every(small)
}
return n
}
smallestCommons([1,5]); //returns 60
Some Tech Wannabe