**Tell us what’s happening:**

For some reason the last two tests are not passing. If I test this code somewhere else I get the right values for the last two tests.

**Your code so far**

```
function smallestCommons(arr) {
let arr = arr.sort((a,b) => a - b);
let arr2 = [];
for(let i = arr[0]; i <= arr[arr.length -1]; i++)
{
arr2.push(i);
}
let x = true;
let LCM = 0;
while(x){
LCM++;
for(let j=arr2[0]; j <= arr2[arr2.length -1]; j++)
{
if(LCM % j !== 0)
{
break;
}
else if(j == arr2[arr2.length -1]) {
x = false;
}
}
}
return LCM;
}
smallestCommons([1,13]);
```

**Your browser information:**

User Agent is: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0`

.

**Link to the challenge:**

https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple/