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
On freeCodeCamp.com please do all [Basic JavaScript](https://www.freecodecamp.com/challenges/learn-how-free-code-camp-works) exercises (there are some topics we did not cover but you can do it). Please make sure you REALLY understand the exercises below:
On freeCodeCamp.com please do the [Basic JavaScript](https://www.freecodecamp.com/challenges/learn-how-free-code-camp-works) exercises up and until the __"Shopping List"__ exercise (there are some topics we did not cover but you can do it).
83
77
84
78
> Hint, if you solve the FreeCodeCamp challenges and they are new concepts to you and you would like to take a look at them later on in the program, Copy your answers from FCC in a .js file and upload them to Github for future reference. In this way you build your own little documentation, if you look back at them first try to understand what it does before you run them.
Copy file name to clipboardExpand all lines: Week2/MAKEME.md
+30-13Lines changed: 30 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,22 @@
1
1
## Homework Week 2
2
2
3
-
### Step 1: JavaScript
3
+
### Step 1: Recap/Read
4
+
5
+
- Have a look at [The Secret Life of JavaScript Primitives](https://javascriptweblog.wordpress.com/2010/09/27/the-secret-life-of-javascript-primitives/)
6
+
- Go through the review of [last week](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md) (Work in progress, update this week :wrench:)
7
+
- Go through the review of [this week](https://github.com/HackYourFuture/JavaScript/blob/master/Week2/REVIEW.md) (work in progress, update this week :nut_and_bolt:)
8
+
9
+
### Step 2: Watch
10
+
11
+
Please watch the following parts of the course, [Programming Foundations Fundamentals](https://www.lynda.com/Programming-Foundations-tutorials/Welcome/83603/90426-4.html) on Lynda.com (if you don't have access to Lynda yet ask Gijs):
12
+
4. Writing Conditional Code
13
+
5. Modular Code
14
+
6. Iteration: Writing Loops
15
+
7. More About Strings
16
+
8. Collections
17
+
11. When Things Go Wrong
18
+
19
+
### Step 3: JavaScript
4
20
> 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
5
21
6
22
1. Create a function that takes 3 arguments and returns the sum of the three arguments.
@@ -28,7 +44,7 @@ if (3 == 3) {
28
44
29
45
9. Change the function `vehicle` to use the list of question 5. So that `vehicle("green", 3, 1)` prints "a green new caravan".
30
46
31
-
10. Use the list of vehicles to write an advertisment. So that it prints something like: `"Amazing Joe's Garage, we service cars, motorbikes, caravans and bikes."`. (Hint: use a `for` loop.)
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.)
32
48
33
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 8?
34
50
@@ -88,15 +104,8 @@ Check out this [Fiddle](http://jsfiddle.net/jimschubert/85M4z/). You need to ope
88
104
89
105
More insights from this [Stack Overflow question](http://stackoverflow.com/questions/22395357/how-to-compare-two-arrays-are-equal-using-javascript).
90
106
91
-
### Step 2: **Some freeCodeCamp challenges:**
92
-
93
-
1.[Comparisons with the Logical And Operator](https://www.freecodecamp.com/challenges/comparisons-with-the-logical-and-operator)
Copy file name to clipboardExpand all lines: Week2/REVIEW.md
+53-32Lines changed: 53 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,59 @@ This review covers:
10
10
• Naming conventions
11
11
```
12
12
13
+
### Recap Logical operators:
14
+
15
+
```js
16
+
0=false
17
+
1=true
18
+
```
19
+
20
+
#### AND `&&`
21
+
22
+
|`&&`|0|1|
23
+
|----|-|-|
24
+
|0|0|0|
25
+
|1|0|1|
26
+
27
+
#### OR `||`
28
+
29
+
|`||`|0|1|
30
+
|----|-|-|
31
+
|0|0|1|
32
+
|1|1|1|
33
+
34
+
## Objects
35
+
36
+
Variables that are objects also contain a list of things, but instead of them being in some specific order, they can be assigned to words, called "keys". Instead of "elements" the things that are inside objects are called "properties".
37
+
38
+
39
+
```js
40
+
let obj = {name:'John', age:24};
41
+
```
42
+
43
+
This object has two properties: `name` and `age`. The "value" of the property `name` is the string `'John'`. The "value" of the property `age` is the number `24`.
44
+
45
+
When accessing object properties, you can use the dot-notation: `obj.name` or the bracket-notation: `obj["name"]`. Note that the latter looks a lot like the way to access array elements. However, here what's inside the bracket (called "key" for objects, instead of "index") must be a string.
46
+
47
+
```js
48
+
console.log(obj.name); // -> 'John'
49
+
console.log(obj['name']); // -> 'John'
50
+
```
51
+
52
+
Just like with arrays, you can also use a variable to access properties, as long as these variables are strings. In this case you cannot use the dot-notation!
53
+
54
+
```js
55
+
var ageKey ='age';
56
+
console.log(obj[ageKey]); // -> 24
57
+
```
58
+
59
+
Remember that there is a very big difference between `obj[name]` and `obj["name"]`.
60
+
61
+
> Note:
62
+
>
63
+
> Thinking back of arrays, the length of an array can be retrieved by `arr.length`. So as mentioned before, arrays are just like other JavaScript objects. You could even write `arr['length']` to access the `length` property of the array. JavaScript will look: is what we put between brackets a number? Then it is an index and we'll look up the correct array element. If it's a string, it's a key and we will look up the corresponding property.
64
+
65
+
13
66
## Functions
14
67
15
68
A function is a reusable piece of code. Functions are *very* important in JavaScript, to the extent that some people call JavaScript a "function-oriented" language. As mentioned above, variables can be of type function. In fact, *every function is a variable*.
@@ -89,38 +142,6 @@ myNumber.toString();
89
142
```
90
143
91
144
92
-
## Objects
93
-
94
-
Variables that are objects also contain a list of things, but instead of them being in some specific order, they can be assigned to words, called "keys". Instead of "elements" the things that are inside objects are called "properties".
95
-
96
-
97
-
```js
98
-
var obj = {name:'John', age:24};
99
-
```
100
-
101
-
This object has two properties: `name` and `age`. The "value" of the property `name` is the string `'John'`. The "value" of the property `age` is the number `24`.
102
-
103
-
When accessing object properties, you can use the dot-notation: `obj.name` or the bracket-notation: `obj["name"]`. Note that the latter looks a lot like the way to access array elements. However, here what's inside the bracket (called "key" for objects, instead of "index") must be a string.
104
-
105
-
```js
106
-
console.log(obj.name); // -> 'John'
107
-
console.log(obj['name']); // -> 'John'
108
-
```
109
-
110
-
Just like with arrays, you can also use a variable to access properties, as long as these variables are strings. In this case you cannot use the dot-notation!
111
-
112
-
```js
113
-
var ageKey ='age';
114
-
console.log(obj[ageKey]); // -> 24
115
-
```
116
-
117
-
Remember that there is a very big difference between `obj[name]` and `obj["name"]`.
118
-
119
-
> Note:
120
-
>
121
-
> Thinking back of arrays, the length of an array can be retrieved by `arr.length`. So as mentioned before, arrays are just like other JavaScript objects. You could even write `arr['length']` to access the `length` property of the array. JavaScript will look: is what we put between brackets a number? Then it is an index and we'll look up the correct array element. If it's a string, it's a key and we will look up the corresponding property.
122
-
123
-
124
145
## Statements & expressions
125
146
126
147
Most programming languages that you'll encounter in real life are called "imperative" programming languages. JavaScript is such an imperative programming language. Imperative is another word for command-like. That is, you give the computer a bunch of commands after each other. First do this, then do that, etc.
And just for fun ... https://www.freecodecamp.com/challenges/sum-all-numbers-in-a-range
17
17
18
+
19
+
20
+
18
21
## And a custom DOM manipulation challenge :mortar_board:
19
22
20
23
1. Open a new js file and start by declaring in array with in there 10 strings. These strings should be of book title's you have read (or made up) and be lowercase without spaces or special characters so that you can use these later as Id's. (Example: Harry Potter's - The Chamber of Secrets -> `harry_potter_chamber_secrets`).
Copy file name to clipboardExpand all lines: Week7/MAKEME.md
+10Lines changed: 10 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,16 @@
11
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
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).
13
13
14
+
### Step 2: **Some freeCodeCamp challenges:**
15
+
16
+
1.[Comparisons with the Logical And Operator](https://www.freecodecamp.com/challenges/comparisons-with-the-logical-and-operator)
0 commit comments