Hi, chris Please explain how iteration work I am not able to uderstand how looping work, In both ,when use isPrime(num) and when use while(!isPrime(i)) . I just want to know how iteration work I mean looping. how i increase and how decrease. for find prime. I hope you help me.
function isPrime(num) {
for(let i=2;i<num;i++) { // here how ‘i’ will work
if(num % i === 0) {
return false;
}
}
return true;
}
// Add your code here
while(i>=2) {
if(!isPrime(i)) { // and also how ‘i’ here is work
i–;
continue;
}
para.textContent += ${i}
;
i–;
}