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: Week3/MAKEME.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Homework Week 3 (moved over from Week 2)
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:
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
4
5
5
```js
6
6
var obj1 = {
@@ -21,6 +21,8 @@
21
21
```
22
22
23
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.
24
26
25
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.
26
28
@@ -48,9 +50,9 @@
48
50
49
51
> Don't cheat! Seriously - try it first.
50
52
51
-
Check out this [Fiddle](http://jsfiddle.net/jimschubert/85M4z/)
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.
52
54
53
-
And this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript)
55
+
More insights from this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript).
54
56
55
57
**Some freeCodeCamp challenges:**
56
58
@@ -67,9 +69,9 @@
67
69
var o2 = { foo: 'bar' };
68
70
var o3 = o2;
69
71
```
70
-
Show that changing `o2` changes `o3` (or not) and changing `o2` changes `o3`(or not).
72
+
Show that changing `o2` changes `o3` (or not) and changing ~~`o2` changes `o3`~~ `o1` changes `o3`(or not).
71
73
72
-
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter?
74
+
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter? {Jim Cramer: ???}
0 commit comments