# Not (!) operator , how does it really work, secondly how does this method account for prime 5 if n is set to limit of 10?

1 Answer

New Answerthis code is used to find prime numbers function showPrime(n){ for( let x=2; x<n; x++){ if( !isPrime(x) ) continue; document.write(x); } } function isPrime(n){ for( let x=2; x<n; x++){ if(n%x==0) return false; } return true; } //n%x let's say n is 10 and x is 5. remainder is 0 ....hence false is returned but 5 is prime ,not sure on this. lastly the return values are being stored in !isPrime(x)...?

12/15/2017 6:12:47 AM

Louis McIntosh1 Answer

New Answer
Hot Today

what is wrong in this driver license code coach problem?
How to copy embed link of YouTube video for web programming in this app?
C++ Challenge problem
how can I make when a button is pressed it changes position
Which is the smallest course in sololearn?
[Solved] Does Earning badges gives us XP?
How to create my own csv in Machine learning
How to make a vector permanent to the memory
how to become a professional?
can anyone explain me this arthimatic operations

Learn Playing. Play Learning

SoloLearn Inc.

4 Embarcadero Center, Suite 1479

San Francisco, CA 94111

© 2020 SoloLearn, Inc. All rights reserved.

Send us a message