Tell us what’s happening:
Hi there
I get the same result as the test result when I run the code in the console, however my answer is not accepted as correct by the assert system
Thanks…
Your code so far
function smallestCommons(arr) {
let max = (arr[0] > arr[1]) ? arr[0] : arr[1];
let min = (arr[0] < arr[1]) ? arr[0] : arr[1];
let scm = max;
let finished = false;
let factor = 1;
while (!finished) {
finished = true;
scm = max * factor;
factor += 1;
for (let i = min; i<max;i++) {
if (scm % i != 0) finished = false;
}
}
return scm;
}
smallestCommons([1,5]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple/