forked from rocketacademy/basics-github-practice
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
37 lines (30 loc) · 834 Bytes
/
script.js
File metadata and controls
37 lines (30 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var roundCounter = 0;
var winCounter = 2;
var main = function (input) {
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;
};