Rock, Paper, Scissors
How do I make an rock, paper, scissors?
This is a pure JS rock, paper, scissors game. The selection that the computer make is purely random.. What is a rock, paper, scissors? How do you make a rock, paper, scissors? This script and codes were developed by Sindhuja on 14 September 2022, Wednesday.
Rock, Paper, Scissors - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Rock, Paper, Scissors</title>
</head>
<body> <script src="js/index.js"></script>
</body>
</html>
Rock, Paper, Scissors - Script Codes JS Codes
var userChoice = prompt("Do you choose rock, paper or scissors?");
var computerChoice = Math.random();
if (computerChoice < 0.34) { computerChoice = "rock";
}
else if(computerChoice <= 0.67) { computerChoice = "paper";
}
else { computerChoice = "scissors";
}
var compare = function(choice1,choice2){
if (choice1 === choice2){
confirm ("The result is a tie!");
}
else if (choice1 === "rock"){
if (choice2 === "scissors"){
confirm ("Rock wins!");
}
else{
confirm ("Paper wins!");
}
}
else if (choice1 === "paper"){
if (choice2 === "rock"){
confirm ("Paper wins!");
}
else{
confirm ("Scissors wins!");
}
}
else if (choice1 === "scissors"){
if (choice2 === "paper"){
confirm ("Scissors wins!");
}
else{
confirm ("Rock wins!");
}
}
};
compare (userChoice, computerChoice);
Developer | Sindhuja |
Username | SindhujaD |
Uploaded | September 14, 2022 |
Rating | 3 |
Size | 1,629 Kb |
Views | 89,056 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Mobile Email Wireframe | 3,028 Kb |
SVG Animation | 3,353 Kb |
Cocoa Brownies Recipe | 3,035 Kb |
Earth Orbit | 2,120 Kb |
Minimal SVG Animation | 2,565 Kb |
Google Redisign | 2,641 Kb |
A Pen by Sindhuja | 1,981 Kb |
SVG Fill Animation | 2,145 Kb |
Animated CodePen Logo | 1,704 Kb |
Pizza Order Form | 1,995 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Filter inputs | Rowinf | 1,721 Kb |
Fun form with currentColor | Bnthor | 2,713 Kb |
Clock with full screen background | Owebboy | 2,415 Kb |
Pure CSS Dial | Lukewatts | 3,018 Kb |
Animate elements with fixed gradient | Badabam | 4,406 Kb |
Test | Dviate | 2,668 Kb |
FCC - Tribute Page | Cmwebby | 0 Kb |
Tooltip in table | Roine | 3,713 Kb |
Simple Buttons | Haydenmills | 1,750 Kb |
Awesome | Samarthpd | 2,901 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!