**Create a function that finds the primes of a number, while not repeating the same number.
Putting the primes into an array.**
My issue is that the divisor is repeated in the array.
`// code javascript
let divisors = [];
function math(number) {
let end = Math.floor(Math.sqrt(number));
for (let i = 1; i <= end; i++) {
let x = number / i;
let z = Math.floor(x);
if (number % i === 0) {
divisors.push(i);
}
if (x != z) {
continue;
}
if (number % x === 0) {
divisors.push(x);
}
}
console.log(divisors);
document.write(`<h3>[${divisors.join(', ')}]</h3>`)
}
math(392); // write the number here`
New contributor
DALTA X is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.