```
function smallestCommons(arr) {
var val;
arr = arr.sort(function(a, b){
return a - b;
});
for(var num=1;;num++)
{
val=lcm(num,arr[0],arr[1]);
if(val===true)
break;
}
function lcm(n,a,b)
{
for(var i=a;i<=b;i++)
{
if(n%i!==0)
return false;
}
return true;
}
```

I first sorted the array smallest to largest, then kept an infinite loop passing no’s from 1 to n to find the number ie.lcm of array of no’s,which will stop once the number is found, then a function to find lcm of all no’s between that array. but its not working for 1,13 and 18,23 while the logic is correct… Thanks in advance.