Skip to content

Commit 5975038

Browse files
committed
merged branches
2 parents 0feaa89 + 1a8c569 commit 5975038

12 files changed

Lines changed: 87 additions & 92 deletions

README.md

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

1818

1919
__Kind note:__

Week2/MAKEME.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,80 @@
11
## Homework Week 2
22

3-
The homework for Week 2 has been moved to Week 3.
3+
1. Create a function that takes two objects as parameters and compares them. You will actually need to write two functions — one that compares with `==` and one that compares with `===`. Remember that objects can have objects inside of them so you'll need to find a way to compare every element of every object (types and values). For example:
4+
5+
```js
6+
var obj1 = {
7+
a: 1,
8+
b: 'this is the letter b',
9+
c: { foo: 'what is a foo anyway',
10+
bar: [1,2,3,4]
11+
}
12+
}
13+
14+
var obj2 = {
15+
a: '1',
16+
b: 'this is the letter b',
17+
c: { foo: 'what is a foo anyway',
18+
bar: [1,2,3,4]
19+
}
20+
}
21+
```
22+
23+
In our example we'll say that `obj1 == obj2` is `true` and `obj1 === obj2` is `false`. Make sure you can see why before you write any code!
24+
25+
Note: give this exercise your best shot but don’t spend more than, say, one hour on it.
26+
27+
2. We saw that we can pass functions as arguments to other functions. Your task is to write a function that takes another function as an argument and runs it.
28+
29+
```js
30+
function foo(func) {
31+
// What to do here?
32+
}
33+
34+
function bar() {
35+
console.log('Hello, I am bar!');
36+
}
37+
38+
foo(bar);
39+
```
40+
41+
42+
Write some code to test two arrays for equality using `==` and `===`. Test the following:
43+
44+
```js
45+
var x = [1,2,3];
46+
var y = [1,2,3];
47+
var z = y;
48+
```
49+
What do you think will happen with `x == y`, `x === y` and `z == y` and `z == x`? Prove it!
50+
51+
> Don't cheat! Seriously - try it first.
52+
53+
Check out this [Fiddle](http://jsfiddle.net/jimschubert/85M4z/). You need to open your browser’s Developer Tools to see the console output. Press the Run button in the upper right corner to run the code.
54+
55+
More insights from this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript).
56+
57+
**Some freeCodeCamp challenges:**
58+
59+
3. [Comparisons with the Logical And Operator](https://www.freecodecamp.com/challenges/comparisons-with-the-logical-and-operator)
60+
61+
4. [Record Collection](https://www.freecodecamp.com/challenges/record-collection)
62+
63+
5. [Iterate over Arrays with map](https://www.freecodecamp.com/challenges/iterate-over-arrays-with-map)
64+
65+
6. We did the following example in class:
66+
67+
```js
68+
var o1 = { foo: 'bar' };
69+
var o2 = { foo: 'bar' };
70+
var o3 = o2;
71+
```
72+
Show that changing `o2` changes `o3` (or not) and changing ~~`o2` changes `o3`~~ `o1` changes `o3`(or not).
73+
74+
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter? {Jim Cramer: ???}
75+
76+
### Some further reading:
77+
78+
Have a look at [The Secret Life of JavaScript Primitives](https://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/)
79+
80+
> ‘Coerce' means to try to change - so coercing `var x = '6'` to number means trying to change the type to number temporarily.

Week2/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Reading material for the third lecture:
22

3-
TBA
3+
## TODO

Week3/MAKEME.md

Lines changed: 1 addition & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +1,4 @@
1-
# Homework Week 3 (moved over from Week 2)
2-
3-
1. Create a function that takes two objects as parameters and compares them. You will actually need to write two functions — one that compares with `==` and one that compares with `===`. Remember that objects can have objects inside of them so you'll need to find a way to compare every element of every object (types and values). For example:
4-
5-
```js
6-
var obj1 = {
7-
a: 1,
8-
b: 'this is the letter b',
9-
c: { foo: 'what is a foo anyway',
10-
bar: [1,2,3,4]
11-
}
12-
}
13-
14-
var obj2 = {
15-
a: '1',
16-
b: 'this is the letter b',
17-
c: { foo: 'what is a foo anyway',
18-
bar: [1,2,3,4]
19-
}
20-
}
21-
```
22-
23-
In our example we'll say that `obj1 == obj2` is `true` and `obj1 === obj2` is `false`. Make sure you can see why before you write any code!
24-
25-
Note: give this exercise your best shot but don’t spend more than, say, one hour on it.
26-
27-
2. We saw that we can pass functions as arguments to other functions. Your task is to write a function that takes another function as an argument and runs it.
28-
29-
```js
30-
function foo(func) {
31-
// What to do here?
32-
}
33-
34-
function bar() {
35-
console.log('Hello, I am bar!');
36-
}
37-
38-
foo(bar);
39-
```
40-
41-
42-
Write some code to test two arrays for equality using `==` and `===`. Test the following:
43-
44-
```js
45-
var x = [1,2,3];
46-
var y = [1,2,3];
47-
var z = y;
48-
```
49-
What do you think will happen with `x == y`, `x === y` and `z == y` and `z == x`? Prove it!
50-
51-
> Don't cheat! Seriously - try it first.
52-
53-
Check out this [Fiddle](http://jsfiddle.net/jimschubert/85M4z/). You need to open your browser’s Developer Tools to see the console output. Press the Run button in the upper right corner to run the code.
54-
55-
More insights from this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript).
56-
57-
**Some freeCodeCamp challenges:**
58-
59-
3. [Comparisons with the Logical And Operator](https://www.freecodecamp.com/challenges/comparisons-with-the-logical-and-operator)
60-
61-
4. [Record Collection](https://www.freecodecamp.com/challenges/record-collection)
62-
63-
5. [Iterate over Arrays with map](https://www.freecodecamp.com/challenges/iterate-over-arrays-with-map)
64-
65-
6. We did the following example in class:
66-
67-
```js
68-
var o1 = { foo: 'bar' };
69-
var o2 = { foo: 'bar' };
70-
var o3 = o2;
71-
```
72-
Show that changing `o2` changes `o3` (or not) and changing ~~`o2` changes `o3`~~ `o1` changes `o3`(or not).
73-
74-
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter? {Jim Cramer: ???}
75-
76-
### Some further reading:
77-
78-
Have a look at [The Secret Life of JavaScript Primitives](https://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/)
79-
80-
> ‘Coerce' means to try to change - so coercing `var x = '6'` to number means trying to change the type to number temporarily.
81-
82-
83-
<!-- Original Week 3 homework
1+
# Homework Week 3
842

853
## Read:
864
- https://github.com/HackYourFuture/JavaScript/blob/master/Week3/README.md
@@ -112,5 +30,3 @@ And a custom DOM manipulation challenge :mortar_board:
11230
6. Beautify your html page with css, add sources and alts to each of the images.
11331

11432
7. __Optional (expert)__ Download book covers for each book, construct a new Object which has as keys the bookId's again, and as value the path to the image source (e.g. `{"harry_potter_blabla": "./img/harry_potter_blabla.jpg", ...}`). Now loop over these entries (_hint: `Object.keys(objectName)` gives you an array containing the keys_). Then write a function which places an image at the corresponding `li` element. Remember that Objects are not ordered, so you cannot guarantee that the first key is the first `li` element. (_Hint: you could give each `li` item an `id` tag by modifying the function you made before_)
115-
116-
-->

Week4/MAKEME.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ movies = sortMovies(movies, 'imdbRating', -1);
3030
Notes:
3131

3232
1. Do not bother to make this work for the `Ratings` property which refers to an object rather than a simple value.
33-
2. It is not necessary to convert property values containing dates or numbers formatted with embedded commas to facilitate sorting for this challenge (but you're welcome to try). You can leave the value 'as is'.
33+
2. It is not necessary to convert property values containing dates or numbers formatted with embedded commas to facilitate sorting for this challenge (but you're welcome to try). You can leave the value 'as is'.
34+

Week8/MAKEME.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ Make this
1414
- Implement a loader icon like in [my codepen](https://codepen.io/Razpudding/pen/BRGqJw) for each xhr response the user has to wait for.
1515
- Add correct HTML/CSS
1616

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.
17+
If you get stuck, remember we have Slack and you can ask questions.

0 commit comments

Comments
 (0)