From a86d675e76aecfbfba003dbc524977fc7d250a72 Mon Sep 17 00:00:00 2001 From: Sarah <sarah.fiedler@rbb-online.de> Date: Tue, 11 Mar 2025 13:52:18 +0100 Subject: [PATCH] add Computer Choice --- game/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/game/index.js b/game/index.js index 78a65c6..03c2c16 100644 --- a/game/index.js +++ b/game/index.js @@ -1,6 +1,8 @@ const options = ["Stein", "Papier", "Schere"]; function getRandomComputerResult(){ - console.log(Math.random()); + const number = Math.floor(Math.random()*options.length); + return options[number]; } -getRandomComputerResult(); \ No newline at end of file + +console.log(getRandomComputerResult()); \ No newline at end of file -- GitLab