I’ve just about got this but I’m struggling with the last test. All the other tests work and the array I create looks ok

Any idea what I’ve done wrong?

```
function smallestCommons(arr) {
var newArr = [];
arr.sort(function(a, b){
return a - b;
});
console.log(arr);
for (var i = arr[0] ; i <= arr[1]; i++){
newArr.push(i);
console.log(newArr);
}
function gcd(i, j) {
if (j === 0)
return i;
else
return gcd(j, i % j);
}
var lcm = newArr[0];
for (var i = newArr[0]; i < newArr.length; i++){
var ans = gcd(lcm, newArr[i]);
lcm = (lcm * newArr[i]) / ans;
console.log(lcm);
}
return lcm;
}
smallestCommons([23, 18]);
```