I am currently doing the smallest common multiple problem and my code works but the problem is that it takes so long to get an answer that it gives me a fail when I put it into freecodecamp. So I was wondering if there was anyway to make my code more effective.

Start of Code:

```
function largerNum(arr){
if(arr[0] > arr[1]){
return arr[0];
}else if(arr[0] < arr[1]){
return arr[1];
}
}
function smallerNum(arr){
if(arr[0] < arr[1]){
return arr[0];
}else if(arr[0] > arr[1]){
return arr[1];
}
}
function loopThrough(start,end,number){
while(start <= end){
if(number%start !== 0){
return false;
}
start++;
}
return true;
}
function smallestCommons(arr) {
var arr1 = [];
var arr2 = [];
var temp1;
var temp2;
var testCase = true;
var largeNum = largerNum(arr);
var smallNum = smallerNum(arr);
var i = 1;
while(testCase){
temp1 = i * arr[0];
temp2 = i * arr[1];
arr1.push(temp1);
arr2.push(temp2);
if(arr1.indexOf(temp2) > -1 && arr2.indexOf(temp2) > -1 && loopThrough(smallNum,largeNum,temp2)){
testCase = false;
return temp2;
}else if(arr1.indexOf(temp1) > -1 && arr2.indexOf(temp1) > -1 && loopThrough(smallNum,largeNum,temp1)){
testCase = false;
return temp1;
}
i++;
}
}
console.log(smallestCommons([23,18]));
```