Skip to content

Commit 4d0883d

Browse files
committed
added review week 3
1 parent aad0d1f commit 4d0883d

3 files changed

Lines changed: 20 additions & 21 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Here you can find course content and homework for the JavaScript 1,2 and 3 modul
1111
|0.|Preparation for your first JavaScript session|[Pre-reading](https://github.com/HackYourFuture/JavaScript/tree/master/Week0) + [CLI Reading Week 1](https://github.com/HackYourFuture/CommandLine/blob/master/Lecture-1.md)|-|
1212
|1.|[CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :heart: <br>• Intro JavaScript (What is it, where can you use it for)<br>• Variables [var, let, const]<br>• Basic Data types [Strings, Numbers, Arrays]<br>• Operators|[Reading Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/README.md) | [Homework Week 1](https://github.com/HackYourFuture/JavaScript/tree/master/Week1/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md)|
1313
|2.|• Advanced data types [Objects] <br>• Conditions <br>• Statements vs Expressions<br> • Loops (for/while)<br>• Functions <br>• Naming conventions|[Reading Week 2](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/README.md)|[Homework Week 2](https://github.com/HackYourFuture/JavaScript/tree/master/Week2/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week2/REVIEW.md)|
14-
|3.|[CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :balloon: <br>• Closures <br>• Scope <br>• Array Manipulations <br>• Basic DOM manipulations [img src, innerHTML]<br>• Code commenting|[Reading Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3)|[Homework Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3/MAKEME.md)|Review|
14+
|3.|[CLI](https://github.com/HackYourFuture/CommandLine) session with Unmesh :balloon: <br>• Closures <br>• Scope <br>• Array Manipulations <br>• Basic DOM manipulations [img src, innerHTML]<br>• Code commenting|[Reading Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3)|[Homework Week 3](https://github.com/HackYourFuture/JavaScript/tree/master/Week3/MAKEME.md)|[Review](https://github.com/HackYourFuture/JavaScript/blob/master/Week3/REVIEW.md)|
1515
|4.|• JSON<br>• Code debugging using the browser<br>• Functions + JSON/Arrays<br>• Code flow (order of execution) <br>• (capturing user input) <br>• Structuring code files|[Reading Week 4](https://github.com/HackYourFuture/JavaScript/tree/master/Week4)|[JS](https://github.com/HackYourFuture/JavaScript/tree/master/Week4/MAKEME.md) + [Git Homework Week 4](https://github.com/HackYourFuture/Git/blob/master/Lecture-1.md)|Review|
1616
|5.|• First Git Session with Unmesh :smiling_imp:<br>• Events<br>• Callbacks <br>• XHTTP Requests <br>• API calls|[Reading Week 5](https://github.com/HackYourFuture/JavaScript/tree/master/Week5)|[Homework Week 5](https://github.com/HackYourFuture/JavaScript/tree/master/Week5/MAKEME.md)|Review|
1717
|6.|• Second Git Session :see_no_evil:<br> • Async VS Sync<br>• Polling<br>• Structure for a basic SPA<br> TEST :boom:|[Reading Week 6](https://github.com/HackYourFuture/JavaScript/tree/master/Week6)|[Homework Week 6](https://github.com/HackYourFuture/JavaScript/tree/master/Week6/MAKEME.md)|Review|

Week3/MAKEME.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
## Step 0 review:
66
- Go through the review of [the first week](https://github.com/HackYourFuture/JavaScript/blob/master/Week1/REVIEW.md) (Work in progress, update this week :wrench:)
77
- Go through the review of [the second week](https://github.com/HackYourFuture/JavaScript/blob/master/Week2/REVIEW.md) (work in progress, update this week :nut_and_bolt:)
8-
- Daan will update the review of this week soon, keep an eye on that!
9-
8+
- Go through the review of [the third week](https://github.com/HackYourFuture/JavaScript/blob/master/Week3/REVIEW.md)
109

1110
## Step 1: Implement feedback
1211

Week3/REVIEW.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ Now, when this sentence is written down without *he* being defined in the contex
3636

3737
### Context in programming:
3838
A JavaScript example:
39-
```
39+
```js
4040
function myFunction() {
4141
const a = 'ravioli'
4242
console.log(a)
4343
}
4444
```
4545

46-
```
46+
```js
4747
function myFunction() {
4848
console.log(a)
4949
}
@@ -60,12 +60,12 @@ So in words more applicable to our situation scope means:
6060
> code that is within the reach of our code.
6161
6262
Consider two completely different JavaScript files
63-
```
63+
```js
6464
// aFile.js
6565
const a = 10
6666
```
6767

68-
```
68+
```js
6969
// anotherFile.js
7070
console.log(a)
7171
```
@@ -109,7 +109,7 @@ The basics.
109109
An array can be created multiple ways
110110

111111
From scratch:
112-
```
112+
```js
113113
const a = [] // result: []
114114
const b = ['item1', 'item2'] // result: ['item1', 'item2']
115115
const c = new Array() // result: []
@@ -120,30 +120,30 @@ const f = new Array(20, 21) // result: [20, 21]
120120
```
121121

122122
From value (as an example, many ways to create an array from another value):
123-
```
123+
```js
124124
const a = 'hello world' // result: 'hello world'
125125
const b = a.split(' ') // result: ['hello', 'world' ]
126126
```
127127

128128
### Array length
129129
Every array has as a 'static' property `length`. Meaning that we can easily get the amount of items in an array.
130-
```
130+
```js
131131
const f = ['hi','there']
132132
console.log(f.length) // 2
133133
```
134134

135135
### Array index
136136
We can access array elements through the position of the element in the array. This is called an index. Indices (plural of index) are 0-based, meaning that the first item's index is 0, the second element is 1.
137137

138-
```
138+
```js
139139
const x = ['first', 'second', 'third']
140140
console.log(x[0]) // 'first'
141141

142142
x[3] = 'fourth'
143143
```
144144

145145
Note that arrays can have empty values. This should be avoided usually to prevent unexpected behaviour.
146-
```
146+
```js
147147
x[10] = 'eleventh'
148148
console.log(x) // [ 'first', 'second', 'third', 'fourth', <6 empty items>, 'eleventh' ]
149149
```
@@ -170,32 +170,32 @@ These methods are essential.
170170
[`.map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) creates a new array with the results of calling a provided function on every element in the calling array.
171171
[`.filter()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) creates a new array with all elements that pass the test implemented by the provided function.
172172
[`.sort()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) sorts the elements of an array in place and returns the array
173-
```
173+
174174

175175
## Basic DOM manipulations
176176
Using JavaScript we can access and manipulate the Document Object Model (DOM). We access the DOM through a global object called `document`.
177177

178178
HTML
179-
```
179+
```html
180180
<body>
181181
<div id="hello"></div>
182182
</body>
183183
```
184184

185185
A common method to access the DOM is by giving a HTML element an ID, and then using the `document` method `getElementById()`
186186

187-
```
187+
```js
188188
const x = document.getElementById('hello')
189189
```
190190

191191
Now we have stored a *reference* of how that HTML element is accessed through the DOM object. We can use this to manipulate the element.
192192

193-
```
193+
```js
194194
x.innerHTML = 'hello'
195195
```
196196

197197
We can also create elements
198-
```
198+
```js
199199
const a = document.createElement('li')
200200
x.appendChild(a)
201201
```
@@ -207,13 +207,13 @@ First the straightforward part: how do we place comments in our code?
207207

208208
### JavaScript
209209
Single line comments
210-
```
210+
```js
211211
// Change heading:
212212
document.getElementById("myH").innerHTML = "My First Page";
213213
```
214214

215215
Single line comments at end of the line:
216-
```
216+
```js
217217
var x = 5; // Declare x, give it the value of 5
218218
```
219219

@@ -222,7 +222,7 @@ Coding **well** in JavaScript: [JSDoc](http://usejsdoc.org/)
222222
### HTML
223223
[W3Schools](https://www.w3schools.com/html/html_comments.asp)
224224
Comments
225-
```
225+
```html
226226
<!-- Write
227227
your comments here -->
228228

@@ -232,7 +232,7 @@ your comments here -->
232232

233233
### CSS
234234
[MDN on CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments)
235-
```
235+
```css
236236
/* Comment */
237237

238238
/*

0 commit comments

Comments
 (0)