This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
root: true, | |
env: { browser: true, es2020: true }, | |
extends: [ | |
'eslint:recommended', | |
'plugin:react/recommended', | |
'plugin:react/jsx-runtime', | |
'plugin:react-hooks/recommended', | |
], | |
ignorePatterns: ['dist', '.eslintrc.cjs'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Rock, Paper, Scissors: Refactored with Functions | |
const initGame = () => { | |
const startGame = confirm("Shall we play rock, paper, or scissors?"); | |
startGame ? playGame() : alert("Ok, maybe next time."); | |
}; | |
// Game flow function | |
const playGame = () => { | |
while (true) { | |
let playerChoice = getPlayerChoice(); |