Skip to content

Commit 8a91bf8

Browse files
authored
Update MAKEME.md
1 parent f3e2afc commit 8a91bf8

1 file changed

Lines changed: 13 additions & 76 deletions

File tree

Week2/MAKEME.md

Lines changed: 13 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,24 @@
22

33
>[Here](https://github.com/SocialHackersCodeSchool/JavaScript/tree/master/Week2/README.md) you find the readings you have to complete before the third lecture.
44
5-
## Step 1: Recap/Read
6-
7-
- Have a look at [The Secret Life of JavaScript Primitives](https://www.youtube.com/watch?v=2ZUDcmWW4Hc)
8-
- Go through the review of [last week](https://github.com/SocialHackersCodeSchool/JavaScript/blob/master/Week1/REVIEW.md) (Work in progress, update this week :wrench:)
9-
- Go through the review of [this week](https://github.com/SocialHackersCodeSchool/JavaScript/blob/master/Week2/REVIEW.md) (work in progress, update this week :nut_and_bolt:)
10-
11-
## Step 2: Watch
5+
## Step 1: Watch
126

137
1. If you haven't done already, watch: [What is programming](https://www.khanacademy.org/computing/computer-programming/programming/intro-to-programming/v/programming-intro) Just watch the 2 min video, you do not have to do the entire JavaScript course (It could be useful later on though).
148

159
2. If you want a refresher on Functions you should see [this video](https://www.youtube.com/watch?v=5nuqALOHN1M).
1610

1711
3. If you want a refresher on Objects you should see [this video](https://www.youtube.com/watch?v=mgwiCUpuCxA)
1812

19-
## Step 3: JavaScript
13+
## Step 2: JavaScript
2014
> 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
2115
2216
1. Create a function that takes 3 arguments and returns the sum of the three arguments.
2317

2418
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.)
2519

26-
3. Create an object and a function that takes the object as a parameter and prints out all of its names and values.
20+
3. Create a function named `vehicleType` that receives a color, and a code, 1 for car, 2 for motorbike. And prints "a blue motorbike" for example when called as `vehicleType("blue", 2)`
2721

28-
4. Create a function named `vehicleType` that receives a color, and a code, 1 for car, 2 for motorbike. And prints "a blue motorbike" for example when called as `vehicleType("blue", 2)`
29-
30-
5. Can you write the following without the `if` statement, but with just as a single line with `console.log(...);`?
22+
4. Can you write the following without the `if` statement, but with just as a single line with `console.log(...);`?
3123
```js
3224
if (3 == 3) {
3325
console.log("true")
@@ -36,60 +28,19 @@ if (3 == 3) {
3628
}
3729
```
3830

39-
6. Create a function called `vehicle`, like before, but takes another parameter called age, so that `vehicle("blue", 1, 5)` prints "a blue used car"
40-
41-
7. Make a list of vehicles, you can add `"motorbike"`, `"caravan"`, `"bike"`, or more.
42-
43-
8. How do you get the third element from that list?
44-
45-
9. Change the function `vehicle` to use the list of question 4. So that `vehicle("green", 3, 1)` prints "a green new caravan".
46-
47-
10. Use the list of vehicles to write an advertisement. So that it prints something like: `"Amazing Joe's Garage, we service cars, motorbikes, caravans and bikes."`. (Hint: use a `for` loop.)
31+
5. Create a function called `vehicle`, like before, but takes another parameter called age, so that `vehicle("blue", 1, 5)` prints "a blue used car"
4832

49-
11. What if you add one more vehicle to the list, can you have that added to the advertisement without changing the code for question 7?
50-
51-
12. Create an empty object
52-
53-
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:
54-
55-
```js
56-
var obj1 = {
57-
a: 1,
58-
b: 'this is the letter b',
59-
c: { foo: 'what is a foo anyway',
60-
bar: [1,2,3,4]
61-
}
62-
}
63-
64-
var obj2 = {
65-
a: '1',
66-
b: 'this is the letter b',
67-
c: { foo: 'what is a foo anyway',
68-
bar: [1,2,3,4]
69-
}
70-
}
71-
```
33+
6. Make a list of vehicles, you can add `"motorbike"`, `"caravan"`, `"bike"`, or more.
7234

73-
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!
74-
75-
Note: give this exercise your best shot but don’t spend more than, say, one hour on it.
35+
7. How do you get the third element from that list?
7636

77-
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.
37+
8. Change the function `vehicle` to use the list of question 4. So that `vehicle("green", 3, 1)` prints "a green new caravan".
7838

79-
```js
80-
function foo(func) {
81-
// What to do here?
82-
}
83-
84-
function bar() {
85-
console.log('Hello, I am bar!');
86-
}
87-
88-
foo(bar);
89-
```
39+
9. Use the list of vehicles to write an advertisement. So that it prints something like: `"Amazing Joe's Garage, we service cars, motorbikes, caravans and bikes."`. (Hint: use a `for` loop.)
9040

41+
10. What if you add one more vehicle to the list, can you have that added to the advertisement without changing the code for question 7?
9142

92-
15. Write some code to test two arrays for equality using `==` and `===`. Test the following:
43+
11. Write some code to test two arrays for equality using `==` and `===`. Test the following:
9344

9445
```js
9546
var x = [1,2,3];
@@ -106,21 +57,7 @@ Check out this [Fiddle](http://jsfiddle.net/jimschubert/85M4z/). You need to ope
10657

10758
More insights from this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript).
10859

109-
110-
16. Take a look at the following code:
111-
112-
```js
113-
var o1 = { foo: 'bar' };
114-
var o2 = { foo: 'bar' };
115-
var o3 = o2;
116-
117-
```
118-
119-
Show that changing `o2` changes `o3` (or not) and changing ~~`o2` changes `o3`~~ `o1` changes `o3`(or not).
120-
121-
Does the order that you assign (`o3 = o2` or `o2 = o3`) matter? {Jim Cramer: ???}
122-
123-
17. What does the following code return? (And why?)
60+
12. What does the following code return? (And why?)
12461
```js
12562
let bar = 42;
12663
typeof typeof bar;
@@ -129,7 +66,7 @@ typeof typeof bar;
12966

13067
> ‘Coerce' means to try to change - so coercing `var x = '6'` to number means trying to change the type to number temporarily.
13168
132-
### Step 4: **Some freeCodeCamp challenges (10 hours):**
69+
### Step 3: **Some freeCodeCamp challenges (10 hours):**
13370

13471
On freeCodeCamp.com please do the [Basic JavaScript](https://www.freecodecamp.org/map) exercises up and until the __"Shopping List"__ exercise (there are some topics we did not cover but you can do it).
13572

0 commit comments

Comments
 (0)