# FCC LCM for last problem is not the LCM possible

Tell us what’s happening:
I have got my code for the work below. The last problem is not passed as correct because you need to have 6056820 for the least common multiple. However, I get 605682 which is divisible by the whole range and low than the required amount. Making 605682 the LCM for the array. Please let me know where I might have gone wrong.

My code so far

``````
function smallestCommons(arr) {
let newArr = [];
newArr = arr.sort(function(a,b) {return a-b});
for (let i = 0; i< arr.length; i++) {
if (arr[i+1] !== arr[i]+1 && arr[arr.length-2] !== arr[arr.length -1] -1) {
newArr.push(newArr[i]+1);
newArr.sort(function(a,b) {return a-b});
}
}
if (toString.call(newArr) !== "[object Array]") {
return  false;
}
var r1 = 0, r2 = 0;
var l = newArr.length;
for(let i=0; i < l; i++) {
r1 = newArr[i] % newArr[i + 1];
if(r1 === 0) {
newArr[i + 1] = (newArr[i] * newArr[i+1]) / newArr[i + 1];
}
else {
r2 = newArr[i + 1] % r1;
if(r2 === 0) {
newArr[i + 1] = (newArr[i] * newArr[i + 1]) / r1;
}
else {
newArr[i+1] = (newArr[i] * newArr[i + 1]) / r2;
}
}
}
console.log(newArr)
return newArr[l - 1];
}

smallestCommons([23, 18]);

``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36`.