Loading [Contrib]/a11y/accessibility-menu.js
Back
Close

Code Snippets

NavinNavi19
3,292 views

Welcome to the Collection of Javascript Code Snippets

Prime Numbers OR Not

function fnc(n) {
for (let i = 2; i < n; i++) {
if (n % i === 0) return false;
}
return true;
}
console.log(fnc(7));
console.log(fnc(9));
console.log(fnc(23));
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants