Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f79583a

Browse files
committed
rearenged homework
1 parent fbf518a commit f79583a

File tree

6 files changed

+53
-62
lines changed

6 files changed

+53
-62
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Here you can find course content and homework for the JavaScript 1,2 and 3 modul
1313
|4.|• Capturing user input <br>• Events<br>• [Basic DOM manipulations (img src, innerHTML)](fundamentals/DOM_manipulation.md)<br>• Code debugging using the browser <br>• [Code commenting](fundamentals/code_commenting.md)<br>• Structuring code files |[Reading Week 4](/Week4/README.md)|[Homework Week 4](/Week4/MAKEME.md)|
1414
|5.|• Functions + JSON/Arrays<br>• [Array Manipulations](fundamentals/array_manipulation.md)<br>• JSON<br>• [Map and filter](fundamentals/map_filter.md)<br>• Arrow functions |[Reading Week 5](/Week5/README.md)|[Homework Week 5](/Week5/MAKEME.md)|
1515
|6.|[Closures](fundamentals/scope_closures_this.md) <br>• Callbacks|[Reading Week 6](/Week6/README.md)|[Homework Week 6](/Week6/MAKEME.md)|
16-
|7.|• Object Oriented Programming <br>• Code flow (order of execution) <br>• Async vs Sync|[Reading Week 7](/Week7/README.md)|[Homework Week 7](/Week7/MAKEME.md)|
16+
|7.|• Object Oriented Programming <br>• [Promises](fundamentals/promises.md)|[Reading Week 7](/Week7/README.md)|[Homework Week 7](/Week7/MAKEME.md)|
1717
|8.|• Structure for a basic SPA (Single Page Application) <br>• [XMLHttpRequests](fundamentals/XMLHttpRequest.md) <br>• API calls|[Reading Week 8](/Week8/README.md)|[Homework Week 8](/Week8/MAKEME.md)|
18-
|9.|• (re)writing data structures (in JSON) <br>• [Promises](fundamentals/promises.md)|[Reading Week 9](/Week9/README.md)|[Homework Week 9](/Week9/MAKEME.md)|
18+
|9.|• (re)writing data structures (in JSON) <br>• Async vs Sync • Code flow (order of execution) |[Reading Week 9](/Week9/README.md)|[Homework Week 9](/Week9/MAKEME.md)|
1919

2020
__Kind note:__
2121

Week6/README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,22 @@ In week seven we will discuss the following topics:
77
• call
88
• apply
99
• bind
10-
• Code flow (order of execution)
11-
10+
• Promises
1211
```
1312

1413
### Here are resources that we like you to read as a preparation for the coming lecture:
1514

16-
#### Closures and async code
17-
- [Why closures are helpful with async code](http://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript)
18-
1915
### `call` `apply`, `bind`
2016
- [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call)
2117
- [Function.prototype.apply()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply)
2218
- [Function.prototype.bind()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind)
2319

24-
_Please go through the material and come to class prepared!_
25-
26-
27-
28-
29-
20+
#### Promises
21+
Some nice resources about promises :ring:
22+
- [Googles post about Promises](https://developers.google.com/web/fundamentals/getting-started/primers/promises)
23+
- [A nice article from David Walsh](https://davidwalsh.name/promises)
24+
- [A real life example](https://github.com/mdn/js-examples/blob/master/promises-test/index.html)
25+
- [stackoverflow]http://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript
3026

27+
_Please go through the material and come to class prepared!_
3128

Week7/README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ In week eight we will discuss the following topics:
55
• Structure for a basic SPA
66
• XMLHttpRequests
77
• API calls
8-
• Async VS Sync
98
```
109

1110
### Here are resources that we like you to read as a preparation for the coming lecture:
1211

13-
#### Async VS Sync
14-
- Read about Asynchronous vs. Synchronous programming: http://www.hongkiat.com/blog/synchronous-asynchronous-javascript/
15-
1612
#### APIs
1713
- Read about APIS: https://www.programmableweb.com/api-university/what-are-apis-and-how-do-they-work
1814

Week8/MAKEME.md

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Topics discussed this week:
55
• Structure for a basic SPA
66
• XMLHttpRequests
77
• API calls
8-
• Async VS Sync
98
```
109

1110

@@ -25,41 +24,7 @@ _Deadline Saturday_
2524

2625
:point_up:
2726

28-
## Step 3: Async challenge
29-
30-
_Deadline Saturday_
31-
32-
1. Rewrite the code below to Async:
33-
34-
```js
35-
1.
36-
37-
let sum = calculateSum(2, 6);
38-
console.log(sum);
39-
40-
2.
41-
42-
let results = $.getJSON('http://myapi.com');
43-
showResults(results);
44-
45-
3.
46-
47-
let sum = calculateSum(2, 6);
48-
if (sum > 8) {
49-
console.log('larger than 8');
50-
}
51-
52-
4.
53-
54-
let data = $.getJSON('http://myapi.com');
55-
data = data.map(function (x) { return x * 8; });
56-
57-
writeDataToFile(data);
58-
```
59-
60-
61-
62-
## Step 4: SPA :sweat_drops:
27+
## Step 3: SPA :sweat_drops:
6328

6429
_Deadline Saturday_
6530

Week8/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
```
44
In week nine we will discuss the following topics:
55
• (re)writing data structures (in JSON)
6-
• Promises
6+
• Async VS Sync
7+
• Code flow (order of execution)
78
```
89

910
### Here are resources that we like you to read as a preparation for the coming lecture:
1011

11-
#### Promises
12-
Some nice resources about promises :ring:
13-
- [Googles post about Promises](https://developers.google.com/web/fundamentals/getting-started/primers/promises)
14-
- [A nice article from David Walsh](https://davidwalsh.name/promises)
15-
- [A real life example](https://github.com/mdn/js-examples/blob/master/promises-test/index.html)
16-
- [stackoverflow]http://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript
12+
#### Async VS Sync
13+
- Read about Asynchronous vs. Synchronous programming: http://www.hongkiat.com/blog/synchronous-asynchronous-javascript/
14+
15+
#### Closures and async code
16+
- [Why closures are helpful with async code](http://stackoverflow.com/questions/13343340/calling-an-asynchronous-function-within-a-for-loop-in-javascript)
1717

1818
_Please go through the material and come to class prepared!_
1919

Week9/MAKEME.md

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
```
44
Topics discussed this week:
55
• (re)writing data structures (in JSON)
6-
• Promises
6+
• Async VS Sync
7+
• Code flow (order of execution)
78
```
89

910
## Step 1: Read
@@ -27,7 +28,39 @@ So please:
2728
- Follow the instructions in the REAME.md of the above repository
2829
- To hand in your homework you make a PR to the existing repository
2930

30-
## Step 4: Read before next lecture
31+
## Step 4: Async challenge
32+
33+
_Deadline Saturday_
34+
35+
1. Rewrite the code below to Async:
36+
37+
```js
38+
1.
39+
40+
let sum = calculateSum(2, 6);
41+
console.log(sum);
42+
43+
2.
44+
45+
let results = $.getJSON('http://myapi.com');
46+
showResults(results);
47+
48+
3.
49+
50+
let sum = calculateSum(2, 6);
51+
if (sum > 8) {
52+
console.log('larger than 8');
53+
}
54+
55+
4.
56+
57+
let data = $.getJSON('http://myapi.com');
58+
data = data.map(function (x) { return x * 8; });
59+
60+
writeDataToFile(data);
61+
```
62+
63+
## Step 5: Read before next lecture
3164

3265
_Deadline Sunday morning_
3366

0 commit comments

Comments
 (0)