forked from gabischool/Week3_JS_Introduction
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
54 lines (36 loc) · 1.59 KB
/
functions.js
File metadata and controls
54 lines (36 loc) · 1.59 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task: Convert to Arrow Function 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
// Take the commented ES5 syntax and convert it to ES6 arrow Syntax
/*
------------
function myFunction() {
console.log("Function was invoked!");
};
myFunction();
----------------
let anotherFunction = function (param) {
return param;
};
anotherFunction("Example");
---------------
let add = function (param1, param2) {
return param1 + param2;
};
add(1,2);
*/
/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task: Rock, Paper, Scissors - Let's play against the computer! 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
/*
Create a global variable that randomly generates the computer's choice
Use Math.random to determine the computers choice (Math.random gives a random number between 0 and 1)
HINT: While you can complete this with only conditionals based on strings, it may help to equate choice to a number when using Math.random()
Use the game function below to do the following:
1. Receive 2 parameters the user's choice and the computer's choice
2. Return whether the user won, lost, or tied based on these rules of the game described below - the strings returned need to match the strings below exactly.
- win should return "you win!"
- lose should return "you lose!"
- tie should return "it's a tie"
RULES OF THE GAME: Scissors beats Paper | Paper beats Rock | Rock beats Scissors | Or there's a tie
HINT: Remember that the order in which we pass in our arguments matters when it comes to parameters
*/
function game(user, computer){
/*add your code here*/
}