-
Notifications
You must be signed in to change notification settings - Fork 24
/
level-three.js
39 lines (33 loc) · 1006 Bytes
/
level-three.js
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
/*************************************/
/* Level Three - for-loop Exercises */
/*************************************/
/*
Create a variable with a blank string
Create a loop that will repeat an X number of times determined by the parameter
Append to the variable each time the loop is run
ie:
repeatString("once", 1) => "once"
repeatString("ditto", 2) => "dittoditto"
repeatString("yes", 3) => "yesyesyes"
*/
function repeatString(message, times) {
}
/*
Adds the given number by the number before it until the number 0
ie:
summation(0) => 0
summation(1) => 1 or (1 + 0)
summation(3) => 6 or (3 + 2 + 1 = 6)
summation(5) => 15 or (5 + 4 + 3 + 2 + 1 = 15)
*/
function summation(number) {
}
/*
Multiplies the given number by the number before it until the number 1
ie:
factorial(1) => 1
factorial(3) => 6 or (3 * 2 * 1 = 6)
factorial(5) => 120 or (5 * 4 * 3 * 2 * 1 = 120)
*/
function factorial(number) {
}