Posts by Pedro Matoso • 111 points
1 post
- 
		10 votes2 answers217 viewsQ: Why does this if check "if it’s ! false" instead of "if it’s true"?I came across this piece of code: function showPrimes(n) { for (let i = 2; i < n; i++) { if (!isPrime(i)) continue; alert(i); // a prime } } function isPrime(n) { for (let i = 2; i < n; i++) {…