Home / Divisors
Write a function the lists all the potential divisors of a number. You will likely need a loop to do this.
/**
* Generates a list of divisors of teh given number.
*
* @param {number} num - The number to check.
* @returns {array} A list of integer divisors.
*/
function getDivisors(num) {
// ...
}
console.log()
the input.divisors
.n
number of times.i
.i
, add it to the divisors
array.divisors
array.What is the lowest number of loop iterations needed to achieve this?