type or paste code here
function smallestCommons(arr) {
let multiple=lcm(arr[0],arr[1]);
for( let j=arr[0]+1;j<arr[1];j++){
multiple=(lcm(multiple,arr[j]));
console.log(multiple);
}
return multiple;
}
function lcm(arg1,arg2){
let max = arg1 > arg2 ? arg1 : arg2;
let i = max, bool= true;
while( bool === true ){
if(i%arg1===0 && i%arg2===0)
{
return i;
} else {
i = i + max;
}
}
}
smallestCommons ([1,5]);
Why isn’t my code working…? please help me.