From 4b5f653c2fdc56ccc8f2cb652f2ede8d384e4578 Mon Sep 17 00:00:00 2001 From: NetMan <13informatyka14@gmail.com> Date: Wed, 3 Jan 2024 19:36:00 +0100 Subject: [PATCH] Added random PC choice --- index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/index.js b/index.js index e69de29..79f9ad6 100644 --- a/index.js +++ b/index.js @@ -0,0 +1,7 @@ +const choices = ["rock", "paper", "scissors"]; + +function getComputerChoice() { + return choices[Math.floor(Math.random() * 3)]; +} + +console.log(getComputerChoice()); \ No newline at end of file