Factor Chain js code example
Example 1: javascript factor chain
function factorChain (arr) {
return arr.reduce((a, c, i) => arr[i] % arr[i-1] === 0);
}
Example 2: javascript factor chain
const factors = number => [...Array(number + 1).keys()].filter(i=>number % i === 0);
console.log(factors(36)); // [1, 2, 3, 4, 6, 9, 12, 18, 36]