Could someone give me a hint on the problem here , or at least at my code
Your code so far
function smallestCommons(arr) {
let newa = []
arr.sort((a,b)=>a-b)
let x = arr[arr.length-1]
let aywAna = true;
let love = 2;
for(let i = arr[0];i<=x;i++){
newa.push(i)
}
while(aywAna){
if(newa.every(x=>x%love==0)){
aywAna = false;
}
love++
}
return x;
console.log(newa)
}
smallestCommons([1,5]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
.
Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/intermediate-algorithm-scripting/smallest-common-multiple