Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript factor chain

const factors = number => Array
    .from(Array(number + 1), (_, i) => i)
    .filter(i => number % i === 0)

 console.log(factors(36));      //  [1, 2, 3, 4, 6, 9, 12, 18, 36]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #javascript #factor #chain
ADD COMMENT
Topic
Name
5+1 =