forked from HackYourFuture/JavaScript2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex5-LotteryMachine.js
More file actions
38 lines (26 loc) · 1.14 KB
/
ex5-LotteryMachine.js
File metadata and controls
38 lines (26 loc) · 1.14 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
/**
** Exercise 5: The lottery machine **
Don't you just love the thrill of the lottery? What if I told you we can make our own lottery machine? Let'
s get started!
Write a
function that takes 4 arguments.
- A start value
- An end value
- A callback that executes if the number is divisible by 3
- A callback that executes if the number is divisible by 5
The function should first generate an array containing values from start value to end value(inclusive).
Then the function should take the newly created array and iterate over it, and calling the first callback
if the array value is divisible by 3.
The function should call the second callback
if the array value is divisible by 5.
Both functions should be called
if the array value is divisible by both 3 and 5.
*/
function threeFive(startIndex, stopIndex, threeCallback, fiveCallback) {
const numbers = [];
// make array
// start at beginning of array and check if you should call threeCallback or fiveCallback or go on to next
}
threeFive(10, 15, sayThree, sayFive);
// Should create an array [10,11,12,13,14,15]
// and call sayFive, sayThree, sayThree, sayFive