const gcd = (a, b) => b ? gcd(b, a % b) : a; console.log(gcd(12, 18)); // 6
const gcd = (a, b) => b ? gcd(b, a % b) : a; const lcm = (arr) => arr.reduce((a, b) => a * b / gcd(a, b)); console.log(lcm([2,6,8,14])); // 168