Skip to content

Commit 7aa7f5b

Browse files
committed
updated master
1 parent f607f66 commit 7aa7f5b

6 files changed

Lines changed: 126 additions & 92 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ Here you can find course content and homework for the JavaScript 1,2 and 3 modul
1313
|5.|• Second Git Session :see_no_evil:<br>• Events<br>• Callbacks <br>• XHTTP Requests <br>• API calls|[Reading Week 5](https://github.com/HackYourFuture/JavaScript/tree/master/Week5)|[Homework Week 5](https://github.com/HackYourFuture/JavaScript/tree/master/Week5/MAKEME.md) |
1414
|6.|• Async VS Sync <br>• Polling<br>• Structure for a basic SPA <br> TEST :boom:|[Reading Week 6](https://github.com/HackYourFuture/JavaScript/tree/master/Week6)|[Homework Week 6](https://github.com/HackYourFuture/JavaScript/tree/master/Week6/MAKEME.md)|
1515
|7.|• Third Git Session (Git Workflow :muscle:) <br>• Map, reduce filter|[Reading Week 7](https://github.com/HackYourFuture/JavaScript/tree/master/Week7)|[Homework Week 7](https://github.com/HackYourFuture/JavaScript/tree/master/Week7/MAKEME.md)|
16-
|8.|• (re)writing data structures (in JSON)<br> • Closures <br>• Promises <br>• Object Literals (and other patterns)|TBA|TBA|
17-
|9.|ES6 :hatching_chick: <br>TEST :boom:|TBA|TBA|
16+
|8.|• (re)writing data structures (in JSON)<br> • Closures <br>• Promises <br>|[Reading Week 8](https://github.com/HackYourFuture/JavaScript/tree/master/Week8/README.md)|[Homework Week 8](https://github.com/HackYourFuture/JavaScript/tree/master/Week8/MAKEME.md)|
17+
|9.|ES6 :hatching_chick: <br>• Object Literals (and other patterns)<br>TEST :boom:|[Reading Week 9](https://github.com/HackYourFuture/JavaScript/tree/master/Week9/README.md)|[Homework Week 9](https://github.com/HackYourFuture/JavaScript/tree/master/Week9/MAKEME.MD)|
1818

1919

2020
__Kind note:__

Week7/MAKEME.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,11 @@
22

33
## Git Homework:
44

5-
[Make these assignments](https://github.com/HackYourFuture/Git/blob/master/Lecture-3.md)
5+
[Make these assignments](https://github.com/HackYourFuture/Git/blob/master/Lecture-3.md)
6+
7+
## Git Homework:
8+
- Finish last week's assignment
9+
- Solve all your Git issues. DO NO CLOSE AN ISSUE WITHOUT AN EXPLANATION OR CODE COMMIT REFERENCING THAT ISSUE
10+
- Add map, filter, reduce to your existing app to build an application that loads data from github, filters out based on certain value, map->reduces to a data object and render that object to the dom (using map again).
11+
- Add polling to your app so that it checks every minute or so if a new repo has been made and if it has, adds it to the DOM without reloading the page.
12+
- Add a readme to your repo explaining what your app does and how to use your app. Here's a [template](https://gist.github.com/jxson/1784669) and here you can see how to make [your readme awesome](https://gist.github.com/rrgayhart/91bba7bb39ea60136e5c).

Week8/MAKEME.md

Lines changed: 16 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,17 @@
11
# Homework Week 8
2-
3-
http://conceptf1.blogspot.nl/2013/11/javascript-closures.html https://toddmotto.com/everything-you-wanted-to-know-about-javascript-scope/ http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html https://medium.freecodecamp.com/5-javascript-bad-parts-that-are-fixed-in-es6-c7c45d44fd81
4-
5-
https://www.reddit.com/r/learnjavascript/comments/1v6n8p/closure_explain_likei_am_in_high_school/?st=ixsp0mbe&sh=5526d150 A VERY popular StackOverflow article: http://stackoverflow.com/questions/111102/how-do-javascript-closures-work
6-
7-
1. Let's continue to learn a little more about scope and Closures.
8-
9-
10-
2. What will be the output of the following code - and more importantly - WHY?
11-
12-
```js
13-
for (var i = 0; i < 3; i++) {
14-
setTimeout(function() { alert(i); }, 1000 + i);
15-
}
16-
```
17-
18-
19-
3. Write a function that would allow you to do this:
20-
```js
21-
var addSix = createBase(6);
22-
addSix(10); // returns 16
23-
addSix(21); // returns 27
24-
```
25-
26-
4. You will need to create an HTML document out of the below snippet to run the below code. A hint - the code is syntactically correct but doesn't do what you would expect. Can you see why and fix it?
27-
28-
Don't cheat - but if you get stuck ... http://stackoverflow.com/questions/750486/javascript-closure-inside-loops-simple-practical-example
29-
30-
```html
31-
<button id="btn-0">Button 1!</button>
32-
<button id="btn-1">Button 2!</button>
33-
<button id="btn-2">Button 3!</button>
34-
35-
<script type="text/javascript">
36-
37-
var prizes = ['A Unicorn!', 'A Hug!', 'Fresh Laundry!'];
38-
for (var btnNum = 0; btnNum < prizes.length; btnNum++) {
39-
// for each of our buttons, when the user clicks it...
40-
document.getElementById('btn-' + btnNum).onclick = function() {
41-
// tell her what she's won!
42-
alert(prizes[btnNum]);
43-
};
44-
}
45-
</script>
46-
```
47-
48-
Rewrite to Async:
49-
50-
```js
51-
1.
52-
53-
var sum = calculateSum(2, 6);
54-
console.log(sum);
55-
56-
2.
57-
58-
var results = $.getJSON('http://myapi.com');
59-
showResults(results);
60-
61-
3.
62-
63-
var sum = calculateSum(2, 6);
64-
if (sum > 8) {
65-
console.log('larger than 8');
66-
}
67-
68-
4.
69-
70-
var data = $.getJSON('http://myapi.com');
71-
data = data.map(function (x) { return x * 8; });
72-
73-
writeDataToFile(data);
74-
```
75-
76-
77-
4. You will need to create an HTML document out of the below snippet to run the below code. A hint - the code is syntactically correct but doesn't do what you would expect. Can you see why and fix it?
78-
79-
TODO !!!
80-
81-
Choose two "GET" API endpoints from http://reqres.in
82-
Use $.getJSON to load data from those two endpoints
83-
Display the data on your web page.
84-
It should not matter which endpoint is loaded first, the data should always look the same (you can add "?delay=" after the endpoint to simulate a delay).
85-
86-
• Create at least 1 issue (bug / feature / code improvement) on another students github repository. Do this in pairs.
87-
• solve the issue proposed by another student in your github repo. More info [here](https://hackyourfuture.slack.com/files/michahell/F31BX1XT6/Merging_a_local_branch_into_master)
2+
This week you will work on finishing your application so it's actually useful!!
3+
4+
[Read this](https://github.com/HackYourFuture/JavaScript/tree/master/Week8/README.md)
5+
6+
Make this
7+
- Check if you have met all the requirements from the previous 2 weeks of homework
8+
- Resolve your Github issues (DO NOT CLOSE AN ISSUE WITHOUT AN EXPLANATION OF BY REFERENCING IT FROM A COMMIT)
9+
- Make sure you have implemented map, filter, reduce. If you lack inspiration, ask on Slack.
10+
- Implement promises in your XHR
11+
- Add polling to your SPA and make sure new info is loaded every 60 seconds. It's probably not a good idea to do a lot of requests every time so maybe just check if a user has new repos.
12+
- Add a local data structure in which you ONLY store the info your app needs. So all the properties of your object should be used somewhere in your app. Don't reference the response of the XHR anymore, just reference your own data structure.
13+
- Make sure you only have one request function that accepts a url parameter and a callback function
14+
- Implement a loader icon like in [my codepen](https://codepen.io/Razpudding/pen/BRGqJw) for each xhr response the user has to wait for.
15+
- Add correct HTML/CSS
16+
17+
If you get stuck, remember we have Slack and you can ask questions. On Slack there's also the list of repos of other students so you can check how they did it.

Week8/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
## Homework week 8
1+
# Reading to be done before the 9th lecture
22

3-
Code to the sort function source from today's first half of the lesson: https://github.com/davidfurlong/sort-function-TDD
3+
Some nice resources about promises :ring:
4+
- [Googles post about Promises](https://developers.google.com/web/fundamentals/getting-started/primers/promises)
5+
- [A nice article from David Walsh](https://davidwalsh.name/promises)
6+
- [A real life example](https://github.com/mdn/js-examples/blob/master/promises-test/index.html)
7+
- [Closures](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures)

Week9/MAKEME.md

Lines changed: 91 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,98 @@
11
# Homework week 9
22

3+
http://conceptf1.blogspot.nl/2013/11/javascript-closures.html https://toddmotto.com/everything-you-wanted-to-know-about-javascript-scope/ http://www.adequatelygood.com/JavaScript-Scoping-and-Hoisting.html https://medium.freecodecamp.com/5-javascript-bad-parts-that-are-fixed-in-es6-c7c45d44fd81
4+
5+
https://www.reddit.com/r/learnjavascript/comments/1v6n8p/closure_explain_likei_am_in_high_school/?st=ixsp0mbe&sh=5526d150 A VERY popular StackOverflow article: http://stackoverflow.com/questions/111102/how-do-javascript-closures-work
6+
7+
1. Let's continue to learn a little more about scope and Closures.
8+
9+
10+
2. What will be the output of the following code - and more importantly - WHY?
11+
12+
```js
13+
for (var i = 0; i < 3; i++) {
14+
setTimeout(function() { alert(i); }, 1000 + i);
15+
}
16+
```
17+
18+
19+
3. Write a function that would allow you to do this:
20+
```js
21+
var addSix = createBase(6);
22+
addSix(10); // returns 16
23+
addSix(21); // returns 27
24+
```
25+
26+
4. You will need to create an HTML document out of the below snippet to run the below code. A hint - the code is syntactically correct but doesn't do what you would expect. Can you see why and fix it?
27+
28+
Don't cheat - but if you get stuck ... http://stackoverflow.com/questions/750486/javascript-closure-inside-loops-simple-practical-example
29+
30+
```html
31+
<button id="btn-0">Button 1!</button>
32+
<button id="btn-1">Button 2!</button>
33+
<button id="btn-2">Button 3!</button>
34+
35+
<script type="text/javascript">
36+
37+
var prizes = ['A Unicorn!', 'A Hug!', 'Fresh Laundry!'];
38+
for (var btnNum = 0; btnNum < prizes.length; btnNum++) {
39+
// for each of our buttons, when the user clicks it...
40+
document.getElementById('btn-' + btnNum).onclick = function() {
41+
// tell her what she's won!
42+
alert(prizes[btnNum]);
43+
};
44+
}
45+
</script>
46+
```
47+
48+
Rewrite to Async:
49+
50+
```js
51+
1.
52+
53+
var sum = calculateSum(2, 6);
54+
console.log(sum);
55+
56+
2.
57+
58+
var results = $.getJSON('http://myapi.com');
59+
showResults(results);
60+
61+
3.
62+
63+
var sum = calculateSum(2, 6);
64+
if (sum > 8) {
65+
console.log('larger than 8');
66+
}
67+
68+
4.
69+
70+
var data = $.getJSON('http://myapi.com');
71+
data = data.map(function (x) { return x * 8; });
72+
73+
writeDataToFile(data);
74+
```
75+
76+
77+
4. You will need to create an HTML document out of the below snippet to run the below code. A hint - the code is syntactically correct but doesn't do what you would expect. Can you see why and fix it?
78+
79+
TODO !!!
80+
81+
Choose two "GET" API endpoints from http://reqres.in
82+
Use $.getJSON to load data from those two endpoints
83+
Display the data on your web page.
84+
It should not matter which endpoint is loaded first, the data should always look the same (you can add "?delay=" after the endpoint to simulate a delay).
85+
86+
• Create at least 1 issue (bug / feature / code improvement) on another students github repository. Do this in pairs.
87+
• solve the issue proposed by another student in your github repo. More info [here](https://hackyourfuture.slack.com/files/michahell/F31BX1XT6/Merging_a_local_branch_into_master)
88+
89+
90+
## Optional homework
91+
```
392
TicTacToe game
493
594
https://github.com/HackYourFuture/TicTacToeTDD
695
https://github.com/HackYourFuture/OOP-Student-and-Teacher
796
8-
rewatch the Hangouts session here: https://www.youtube.com/watch?v=oc9ogCJz9rYs
97+
rewatch the Hangouts session here: https://www.youtube.com/watch?v=oc9ogCJz9rYs
98+
```

Week9/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33
### Refresher
44
https://forum.freecodecamp.com/t/javascript-callback-functions/14658/2
55
http://www.learn-js.org/en/Callbacks
6+
7+
## Check out how to prepare for your first Node lecture here:
8+
https://github.com/HackYourFuture/Node.js/blob/master/week0/README.md

0 commit comments

Comments
 (0)