From 07a9baacbe1c5d49f065cedb7ebca951a1247867 Mon Sep 17 00:00:00 2001 From: michelle-chandiari Date: Sun, 17 Oct 2021 14:17:12 +0800 Subject: [PATCH] added the code --- script.js | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/script.js b/script.js index bbe8a29..03bd457 100644 --- a/script.js +++ b/script.js @@ -1,4 +1,37 @@ +var roundCounter = 0; +var winCounter = 2; + var main = function (input) { - var myOutputValue = 'hello world'; + var secretWord = 2; + console.log(secretWord); + + if (secretWord == 1) { + secretWord = `banana`; + console.log(secretWord); + } + + if (secretWord == 2) { + secretWord = `chisel`; + console.log(secretWord); + } + + if (secretWord == 3) { + secretWord = `faucet`; + console.log(secretWord); + } + + if (input == secretWord) { + winCounter = winCounter - 1; + console.log(secretWord); + } + + var myOutputValue = `you guessed ${input} and the secret word is ${secretWord} and you have to guess ${winCounter} time more to win`; + console.log(myOutputValue); + return myOutputValue; }; +var generateRandomInteger = function () { + var randomDecimal = Math.random() * 3; + var randomInteger = Math.floor(randomDecimal) + 1; + return randomInteger; +};