Tell us what’s happening:
Hi All,
I can get this to pass all tests except for the last one, can someone please help!
Your code so far
function smallestCommons(arr) {
arr.sort((a,b) => a-b);
var indicator = false;
var commonMulti = arr[1];
do {
indicator = true;
for (var i = arr[0]; i <=arr[1]; i++){
if(commonMulti % i != 0){
commonMulti++
indicator = false
}
}
} while (!indicator)
return commonMulti
}
console.log(smallestCommons([23,18]));
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) 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