Skip to content

Commit 9f136f6

Browse files
committed
chanhed homework week2
1 parent 30409d3 commit 9f136f6

File tree

3 files changed

+44
-20
lines changed

3 files changed

+44
-20
lines changed

Week1/MAKEME.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ console.log('I'm awesome');
114114
<br> 6.3 Console.log your array.
115115
<br> 6.4 Create an array that has your favorite animals inside
116116
<br> 6.5 Log your array
117-
<br> 6.6 Add a statement that adds Daan's favorite animal (baby pig) to the existing array
117+
<br> 6.6 Add a statement that adds Daan's favorite animal (baby pig) to the *existing array*
118+
118119
<br> 6.7 Log your new array!
119120

120121
7. More strings
@@ -150,7 +151,7 @@ if () {
150151
9.1 Add at least 3 `console.log` statements in which you show that you understand what `%` does.
151152

152153
10. Write a program to answer the following questions:
153-
10.1 Can you store multiple types in an array? Numbers and strings?
154+
10.1 Can you store multiple types in an array? Numbers and strings? Make an example that illustrates your answer.
154155
<br> 10.2 Can you compare infinities? (Not in Eyad's world) - does 6/0 === 10/0? How can you test this?
155156
<br> 10.3 Add console.log statements to the above program's in which you show that you understand the concepts (just like you've done in the above assignments).
156157

Week2/MAKEME.md

Lines changed: 40 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
>[Here](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/README.md) you find the readings you have to complete before the third lecture.
44
5+
## Step 0: Feedback
6+
7+
_Deadline Monday_
8+
9+
Provide feedback to step 1 and step 3 of the homework of last week to one of your fellow students. You will be assigned to one of the assignments by the class lead of this week.
10+
511
## Step 1: Recap/Read
612

713
- Have a look at [The Secret Life of JavaScript Primitives](https://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/)
@@ -19,12 +25,23 @@
1925
<br>8. Collections
2026
<br>11. When Things Go Wrong
2127

28+
## Step 3: Rover the Robot
29+
30+
Go and try out this cool game: http://hyf-robot.herokuapp.com/index.html, there are different levels, see how far you can get!
31+
32+
2233
## Step 3: JavaScript
34+
35+
_Deadline Thursday_
36+
2337
> For all the following exercises create a new .js file. Try to find a proper name for each file or make a small comment about what it does inside for future reference
2438
39+
*IMPORTANT NOTE*
40+
In each assignment write at least two `console.log` statements to verify if your code works correctly. In other words proof that you code works as expected. If you need inspiration look at the steps defined in the assignments from last week.
41+
2542
1. Create a function that takes 3 arguments and returns the sum of the three arguments.
2643

27-
2. Create a function named `colorCar` that receives a color, and prints out, "a red car" for example. (Hint: put it in your file and run it like before.)
44+
2. Create a function named `colorCar` that receives a color, and prints out, "a red car" for example.
2845

2946
3. Create an object and a function that takes the object as a parameter and prints out all of its names and values.
3047

@@ -53,18 +70,22 @@ if (3 == 3) {
5370

5471
12. Create an empty object
5572

56-
13. 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:
73+
13. Create an object that contains the teachers that you have had so far for the different modules.
74+
75+
14. Add a property to the object you just created that contains the languages that they have taught you.
76+
77+
<!-- 13. 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:
5778
5879
```js
59-
var obj1 = {
80+
let obj1 = {
6081
a: 1,
6182
b: 'this is the letter b',
6283
c: { foo: 'what is a foo anyway',
6384
bar: [1,2,3,4]
6485
}
6586
}
6687
67-
var obj2 = {
88+
let obj2 = {
6889
a: '1',
6990
b: 'this is the letter b',
7091
c: { foo: 'what is a foo anyway',
@@ -76,8 +97,8 @@ if (3 == 3) {
7697
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!
7798
7899
Note: give this exercise your best shot but don’t spend more than, say, one hour on it.
79-
80-
14. 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.
100+
-->
101+
15. 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.
81102

82103
```js
83104
function foo(func) {
@@ -92,12 +113,12 @@ if (3 == 3) {
92113
```
93114

94115

95-
15. Write some code to test two arrays for equality using `==` and `===`. Test the following:
116+
16. Write some code to test two arrays for equality using `==` and `===`. Test the following:
96117

97118
```js
98-
var x = [1,2,3];
99-
var y = [1,2,3];
100-
var z = y;
119+
let x = [1,2,3];
120+
let y = [1,2,3];
121+
let z = y;
101122
```
102123

103124
What do you think will happen with `x == y`, `x === y` and `z == y` and `z == x`? Prove it!
@@ -110,20 +131,20 @@ Check out this [Fiddle](http://jsfiddle.net/jimschubert/85M4z/). You need to ope
110131
More insights from this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript).
111132

112133

113-
16. Take a look at the following code:
134+
17. Take a look at the following code:
114135

115136
```js
116-
var o1 = { foo: 'bar' };
117-
var o2 = { foo: 'bar' };
118-
var o3 = o2;
137+
let o1 = { foo: 'bar' };
138+
let o2 = { foo: 'bar' };
139+
let o3 = o2;
119140

120141
```
121142

122-
Show that changing `o2` changes `o3` (or not) and changing ~~`o2` changes `o3`~~ `o1` changes `o3`(or not).
143+
Show that changing `o2` changes `o3` (or not) and changing ~~`o2` changes `o3`~~ `o1` changes `o3`(or not).
123144

124-
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter? {Jim Cramer: ???}
145+
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter? {Jim Cramer: ???}
125146

126-
17. What does the following code return? (And why?)
147+
18. What does the following code return? (And why?)
127148
```js
128149
let bar = 42;
129150
typeof typeof bar;
@@ -134,6 +155,8 @@ typeof typeof bar;
134155
135156
## Step 4: **Finish basic freeCodeCamp challenges:**
136157

158+
_Deadline Saturday_
159+
137160
Go back to FreeCodeCamp, start where you left of and finish the rest of the Basic JavaScript challenges.
138161

139162
Please make sure you REALLY understand the exercises below:

Week9/MAKEME.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2. What will be the output of the following code - and more importantly - WHY?
2020

2121
```js
22-
for (let i = 0; i < 3; i++) {
22+
for (var i = 0; i < 3; i++) {
2323
setTimeout(function() { alert(i); }, 1000 + i);
2424
}
2525
```

0 commit comments

Comments
 (0)