can you help me understand how this is working ? I cant seem to break down how it’s working. Thank you. this is the specific part const gcd =(a,b) => a ? gcd(b % a, a) : b;
const lcm =(a,b) => a * b /gcd(a,b);
return myArr.reduce(lcm);
**Your code so far**
function smallestCommons(arr) {
let myArr = [];
let min = arr.reduce((a,b) => Math.min(a,b))
let max =arr.reduce((c,d) => Math.max(c,d))
for(let i=min; i<=max; i++){
myArr
.push(i)
}
const gcd =(a,b) => a ? gcd(b % a, a) : b;
const lcm =(a,b) => a * b /gcd(a,b);
return myArr.reduce(lcm);
}
console.log(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/102.0.0.0 Safari/537.36
Challenge: Smallest Common Multiple
Link to the challenge: