FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Problem-solving-with-JavaScript/problem-36.js at master · anasmak04/Problem-solving-with-JavaScript · GitHub
anasmak04
/
Problem-solving-with-JavaScript
Public
forked from
mehediislamripon/Problem-solving-with-JavaScript
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
Problem-solving-with-JavaScript
/
problem-36.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
25 lines (19 loc) · 721 Bytes
Breadcrumbs
Problem-solving-with-JavaScript
/
problem-36.js
Copy path
File metadata and controls
25 lines (19 loc) · 721 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
17
18
19
20
21
22
23
24
25
// Rock Paper Scissors
M1
const
rps
=
(
p1
,
p2
)
=>
{
if
(
p1
==
"scissors"
&&
p2
==
"paper"
||
p1
==
"rock"
&&
p2
==
"scissors"
||
p1
==
"paper"
&&
p2
==
"rock"
)
return
"Player 1 won!"
else
if
(
p1
==
"scissors"
&&
p2
==
"rock"
||
p1
==
"rock"
&&
p2
==
"paper"
||
p1
==
"paper"
&&
p2
==
"scissors"
)
return
"Player 2 won!"
else
return
"Draw!"
}
;
//M2
const
rps1
=
(
p1
,
p2
)
=>
{
return
p1
==
"scissors"
&&
p2
==
"paper"
||
p1
==
"rock"
&&
p2
==
"scissors"
||
p1
==
"paper"
&&
p2
==
"rock"
?
"Player 1 won!"
:
p1
==
"scissors"
&&
p2
==
"rock"
||
p1
==
"rock"
&&
p2
==
"paper"
||
p1
==
"paper"
&&
p2
==
"scissors"
?
"Player 2 won!"
:
"Draw!"
}
Back
|
FazBrowse Home
|
New Git URL