const getGreatestCommonDivisor = (a, b) => {
if (b) {
const newA = b;
const newB = a % b;
return getGreatestCommonDivisor(newA, newB);
}
return a;
};
const getLowestCommonMultiple = (a, b) => {
return (a * b) / getGreatestCommonDivisor(a, b);
};
const solution = (arr) => {
return arr.reduce(getLowestCommonMultiple);
};