My code return the same output as the last test but I can’t past the test.
function smallestCommons(arr) {
arr = arr.sort((a,b) => a - b);
let smallestCommon = 0;
let multiple = arr[1];
while (smallestCommon === 0) {
for (let i = arr[0]; i <= arr[1]; i++) {
if (multiple % i !== 0)
break;
if (i === arr[1])
smallestCommon = multiple;
}
multiple += arr[1];
}
return smallestCommon;
}