Tell us what’s happening:
I don’t understand why the smallest Commons should return 60 instead of 5.
Your code so far
function smallestCommons(arr) {
var arr1 = [];
var arr2 = [];
for(var i=1; i<20;i++) {
arr1.push(i*arr[0]);
arr2.push(i*arr[1]);
}
for(var s=0; s<arr1.length;s++) {
if(arr1[s]%arr[1]==0)
return arr1[s];
}
return undefined;
}
smallestCommons([1,5]);
Your browser information:
Your Browser User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
.
Link to the challenge:
https://www.freecodecamp.org/challenges/smallest-common-multiple