I have this issue with my code. When I use return it displays 1 value, but when I change it to console. It displays all values.
Here are the codes.
function divisors(integer) {
var i;
let array = [];
for( i = 2; i < integer; i++){
if(integer % i === 0)
return i
//console.log(i) gives all values
;
}
return integer + " is prime";
};
console.log(divisors(15))
Any help?