forked from gabischool/Functions-Arrays-Objects
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.js
More file actions
105 lines (68 loc) · 2.97 KB
/
Copy pathfunctions.js
File metadata and controls
105 lines (68 loc) · 2.97 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 1: Multiply 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
/*
Do the following:
1. Invoke the multiply function below and pass it two numbers
2. Receive the parameters: a and b
3. Multiply a and b and return the answer
*/
function multiply(/*add your code here*/){
/*add your code here*/
}
/*
/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 2: Age in Cat years 🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀*/
/*
Do the following:
1. Invoke the catYears function below and pass an age value to it
2. Use the received value to calculate the age in cat years (1 human year is equal to 7 cat years)
3. Return the newly calculated age
*/
function catYears(/*add your code here*/){
/*add your code here*/
}
/*🚀🚀🚀🚀🚀🚀🚀🚀🚀🚀 Task 3: 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 4: 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*/
}
/*💪💪💪💪💪💪💪💪💪💪 Stretch 💪💪💪💪💪💪💪💪💪💪*/
// Let's Sing 99 Bottles of Soda on the Wall!
/*
Using the annoyingSong function below do the following:
1. Receive a starting number and start the count down from the number received
2. At each invocation, it should RETURN this string (note: the tests are expecting the same string as below):
"{number} bottles of soda on the wall, {number} bottles of soda, take one down pass it around {number left over} bottles of soda on the wall"
*/
function annoyingSong(/*add your code here*/){
/*add your code here*/
}