I there, i have this problem. I made my this code solution but the problem is that in visual studio interpreter the code i have made works perfectly but in the FCC interpreter doesnt work, i dont know. the logic it is good i think, and the interpreter of FCC get stuck, like freezed, if i would have a looping problem but i dont have it, it is frustrating because it makes me lose my time when i have founded the solution already. here i let the code.
________________Smallest Common Multiple
function smallestCommons(arr) {
/*Determinate wich number its bigger to make an Array of numbers between them*/
var firstNum=arr[0];
var secondNum=arr[1];
var arrTestedNum=[];
if(firstNum >= secondNum){
for (var i=1; i<firstNum+1; i++){
arrTestedNum.push(i);
}
}else{
for (var j=1; j<secondNum+1; j++){
arrTestedNum.push(j);
}
}
/*Read the Array of numbers to multiply them and find a commun multiple*/
var factor = arrTestedNum.length+1;
var power = false;
while(power===false){
var arrResult =[];
for(var g=0; g<arrTestedNum.length; g++){
arrResult.push(factor/arrTestedNum[g]);
}
var notInteger=[];
for(var a=0; a<arrResult.length; a++){
if(Number.isInteger(arrResult[a])=== false){
notInteger.push(arrResult[a]);}
}
if(notInteger.length===0){
power = true;
break;
}else{
factor ++;
}
}//end of the while
console.log(factor);
}
smallestCommons([13,1]);