You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Week6/MAKEME.md
+24-23Lines changed: 24 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -28,39 +28,40 @@ _Deadline Wednesday_
28
28
29
29
1\. We learned a little bit about callbacks in JS. A callback is simply a function passed to another function that gets executed (run) after a potentially long running operation has completed. There is another function called `setTimeout` that will wait a specified period of time and then execute a function. For example:
30
30
31
-
```js
32
-
function doIt() {
33
-
console.log('I am done');
34
-
}
35
-
setTimeout(doIt, 5000)
36
-
```
37
-
If you run the above code it will wait 5 seconds and print `I am done`. Please read something about setTimeout on MDN. The first argument to the `setTimeout` call is the callback (`doIt`)
38
-
39
-
You must write a function that takes 4 arguments.
31
+
```js
32
+
functiondoIt() {
33
+
console.log('I am done');
34
+
}
35
+
setTimeout(doIt, 5000)
36
+
```
37
+
38
+
If you run the above code it will wait 5 seconds and print `I am done`. Please read something about setTimeout on MDN. The first argument to the `setTimeout` call is the callback (`doIt`)
39
+
40
+
You must write a function that takes 4 arguments.
40
41
- A start value
41
42
- An end value
42
43
- A callback to call if the number is divisible by 3
43
44
- A callback to use if the number is divisible by 5
44
45
45
-
The function should generate an array containing values from start value to end value (inclusive).
46
+
The function should generate an array containing values from start value to end value (inclusive).
46
47
47
-
Then the function should iterate over the array and call the second argument if the array value is divisible by 3
48
+
Then the function should iterate over the array and call the second argument if the array value is divisible by 3
48
49
49
-
The function should call the second argument if the array value is divisible by 5
50
+
The function should call the second argument if the array value is divisible by 5
50
51
51
-
Both functions should be called if the array value is divisible by both 3 and 5
52
+
Both functions should be called if the array value is divisible by both 3 and 5
52
53
53
-
```js
54
-
THIS IS FAKE CODE
55
-
function threeFive(startIndex, stopIndex, threeCallback, fiveCallback) {
56
-
// make array
57
-
// start at beginning of array and check if you should call threeCallback or fiveCallback or go on to next
0 commit comments