This repository is a Rock, Paper, Scissors, Lizard, Spock game that I built to practice my Vanilla JavaScript skills.
Rock, Paper, Scissors, Lizard, Spock is a game invented by Sam Kass and Karen Bryla as an improvement on the classic Rock-Paper-Scissors game due to the fact that when you know someone well enough, 75-80% of any Rock-Paper-Scissors games you play with that person end up in a tie.
You can play this game vs the computer here. You make a selection, the computer will make a random selection and then reveal the result of the choices: You win, Computer wins or It's a draw.I have documented the code in the index.js
with comment blocks.
In the future, I would like to update this project to use Socket.io to allow two human players to play against each other. Feel free to fork the repo and make any additions/improvements as desired.
const
(nolet
orvar
variable declarations), MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/constarrow functions
(nofunction
keyword), MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functionsarray
, MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayTemplate literals
, MDN documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literalsdocument.querySelector
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectordocument.innerHTML
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Document/innerHTMLdocument.innerText
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Document/innerTextdocument.createElement
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Document/createElement- Array method
forEach
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach - Array method
.length
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length Math.floor
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floorMath.random
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/randomSwitch
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switchaddEventListener('click')
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Document/addEventListenersetTimeout()
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeoutappendChild
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Node/appendChildevent.target
, MDN documentation - https://developer.mozilla.org/en-US/docs/Web/API/Event/target
- Improve CSS styling to the game
- Use Socket.io to add two human player functionality
- Fork this repository
- Clone to your local machine
yarn install
in your terminal to install dev dependencies for developmentyarn dev
to start Parcel dev server
yarn build
to have Parcel Bundler compile a production version of the app
If you have any feedback of issues running the project or potential additions/improvements, please feel free to create a new issue to this repository or send me a message on Linkedin here