30 seconds of codeBack to Home
Returns the array of factors of the given
If the second argument is set to
true returns only the prime factors of
0 returns an empty array.
num is less than
0 returns all the factors of
-int together with their additive inverses.
Array.prototype.filter() to find all the factors of
num is negative, use
Array.prototype.reduce() to add the additive inverses to the array.
Return all results if
false, else determine and return only the prime factors using
Omit the second argument,
primes, to return prime and non-prime factors by default.
Note:- Negative numbers are not considered prime.