Employers: discover CodinGame for tech hiring
CodinGame_Logo_Final_Full
ACTIVITIES
PRACTICE
COMPETE
LEARN
COMMUNITY
CONTRIBUTIONS
LIVE STREAMS
DISCORD
FORUMS
BLOG
Get a job
1
1
Log In
Sign Up
Code Snippets
NavinNavi19
3,814 views
Welcome to the Collection of Javascript Code Snippets
Prime Numbers OR Not
1
2
3
4
5
6
7
8
9
10
11
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));
Run
24
1
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
Suggested playgrounds
Introduction à JavaScript - WOA JS
By
stardisblue
8,525
33
A Babel of Languages on CodinGame
By
TBali
4,929
6
Exercices - WOA - Intro JS
By
stardisblue
4,607
10
JavaScript promises, mastering the asynchronous
By
Magus
255.3K
241
CodinGame - Home
ABOUT US
CAREERS
PRIVACY
FAQ
CodinGame - Work
The #1 tech hiring platform
SCREENING
SOURCING
RETAIN
ABOUT US
CAREERS
PRIVACY
FAQ
Facebook
YouTube
Twitter
LinkedIn
FR
EN
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
Keyboard Shortcuts:
?
Show / hide this help menu
×