FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript-Interview-Question/PrimeNumber.js at master · plopfizz/JavaScript-Interview-Question · GitHub
plopfizz
/
JavaScript-Interview-Question
Public
forked from
namitmalasi/JavaScript-Interview-Question
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript-Interview-Question
/
PrimeNumber.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
16 lines (14 loc) · 404 Bytes
Breadcrumbs
JavaScript-Interview-Question
/
PrimeNumber.js
Copy path
File metadata and controls
16 lines (14 loc) · 404 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Prime numbers are the numbers, which are only divisible by 1 and the number itself.
// for example--> 5,7,11,13...
function
isPrime
(
num
)
{
for
(
let
i
=
2
;
i
<=
num
/
2
;
i
++
)
{
if
(
num
%
i
==
0
)
{
return
`
${
num
}
is not a prime number`
;
}
}
return
`
${
num
}
is a prime number`
;
}
console
.
log
(
isPrime
(
4
)
)
;
console
.
log
(
isPrime
(
5
)
)
;
console
.
log
(
isPrime
(
11
)
)
;
console
.
log
(
isPrime
(
19
)
)
;
Back
|
FazBrowse Home
|
New Git URL