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: Week1/LESSONPLAN.md
+61-53Lines changed: 61 additions & 53 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ The purpose of this class is to introduce to the student:
6
6
7
7
- The 2 types of websites: static vs. dynamic
8
8
- The pillars of web development: HTML/CSS/JavaScript
9
+
- where JavaScript can run: Browser / Node
9
10
- What are variables
10
11
- How to name variables properly
11
12
- What are the basic data types
@@ -34,27 +35,43 @@ Examples the two different kind of websites
34
35
Discuss in class which claim belongs to which type of website:
35
36
36
37
Content of Web pages can not be change at runtime.
38
+
39
+
37
40
Server side languages such as PHP, Node.js are used.
41
+
42
+
38
43
Content of Web pages can be changed.
39
-
No interation with database possible.
40
-
Interaction with database is possible
41
-
It is faster to load as compared to the other typ of website.
44
+
45
+
46
+
No interaction with database possible.
47
+
48
+
49
+
Interaction with database is
50
+
51
+
52
+
It is faster to load as compared to the other type of website.
53
+
54
+
42
55
It is slower then static website.
56
+
57
+
58
+
43
59
Lower Development costs.
60
+
61
+
62
+
44
63
Content may change everytime the page is loaded.
64
+
65
+
45
66
Feature of Content Management System.
46
-
HTML, CSS, Javascript is used for developing the website.
47
-
Same content is delivered everytime the page is loaded.
48
67
49
-
<<<<<<< HEAD
50
68
51
-
### Essence
69
+
HTML, CSS, Javascript is used for developing the website.
52
70
53
-
=======
54
71
55
-
##### Essence
72
+
Same content is delivered everytime the page is loaded.
56
73
57
-
> > > > > > > add exercises to part 2
74
+
### Essence
58
75
59
76
[In the link is an article with (dis)advantages of both static and dynamic websites.](https://www.spiderwriting.co.uk/static-dynamic.php)
60
77
@@ -81,13 +98,17 @@ Discuss in class which claim belongs to which type of website:
81
98
- HTML defines what the content is.
82
99
- CSS defines the appearance of the page.
83
100
- JavaScript defines behavior of the page.
101
+
- Where can JavaScript run:
102
+
- browser
103
+
- Node
84
104
85
105
### Example
86
106
87
107
- An example about relationship between HTML, CSS and Javascript using a metaphor of building a city: https://blog.codeanalogies.com/2018/05/09/the-relationship-between-html-css-and-javascript-explained/
88
108
89
109
### Exercise
90
110
111
+
Let students fork and then clone the repository.
91
112
Let students create a classwork directory and create an index.html along with an app.js. Script tag should be added to the end of body tag(reason for doing so is part of JS2 Week1).
92
113
93
114
The end result should look like:
@@ -106,7 +127,7 @@ These static pages can interact with a visitor only through the use of forms. On
106
127
107
128
A big disadvantage of web pages like this is that the only way that a visitor has of interacting with the page is by filling out the form and waiting for a new page to load.
108
129
109
-
It doesn't exhibit any dynamic behaviour like:
130
+
It doesn't exhibit any dynamic behavior like:
110
131
111
132
1. reacting to user actions such as mouse click events or key presses.
112
133
1. rendering complex animations
@@ -116,12 +137,6 @@ It doesn't exhibit any dynamic behaviour like:
116
137
117
138
## 3. What are variables (const & let) & naming conventions
118
139
119
-
=======
120
-
121
-
#### 3. What are variables (const & let) & naming conventions
122
-
123
-
> > > > > > > add exercises to part 2
124
-
125
140
### Explanation
126
141
127
142
In JavaScript, there are three ways of creating variables.
@@ -158,8 +173,8 @@ console.log(age);
158
173
159
174
```javascript
160
175
// Variable Initialization
161
-
var firstName ='Yash';
162
-
let lastName ='Kapila';
176
+
var firstName ='Marco';
177
+
let lastName ='Borsato';
163
178
constage=29;
164
179
165
180
console.log(firstName);
@@ -174,9 +189,9 @@ let lastName = 'Hanks';
174
189
console.log(firstName);
175
190
console.log(lastName);
176
191
177
-
// Assigning variables to a different value
178
-
firstName ='Hanks';
179
-
lastName ='Tom';
192
+
// Assigning a different value to variables
193
+
firstName ='Katy';
194
+
lastName ='Perry';
180
195
181
196
console.log(firstName);
182
197
console.log(lastName);
@@ -191,7 +206,7 @@ console.log(lastName);
191
206
192
207
1. Make 2 variables using the `const` keyword
193
208
1. the first variable should contain the town/city you currently stay at
194
-
1. come up with a value for the second variable yourself
209
+
1. come up with name and a value for the second variable yourself
> > > > > > > Primitive data types are typically types that are built-in or basic to a language implementation.
212
-
213
-
There are 5 different types of data. The compiler/computer interprets all the variables we make as one of those datatypes.
214
-
(https://javascript.info/types)
225
+
In JavaScript, a primitive (primitive value, primitive data type) is data that is not an object and has no methods. There are 7 primitive data types: `string`, `number`, `bigint`, `boolean`, `null`, `undefined`, and `symbol`.
215
226
216
227
Boolean — true or false
217
228
Null — no value
218
229
Undefined — a declared variable but hasn’t been given a value
219
230
Number — integers, floats, etc
220
231
String — an array of characters i.e words
221
-
?? Symbol — a unique value that's not equal to any other value ??
232
+
Symbol — a unique value that's not equal to any other value (not used during HYF)
222
233
223
234
### Example
224
235
225
236
-`string`, e.g. "HackYourFuture"
226
237
-`number`, e.g. 5, or 10.6
227
238
-`boolean`, e.g. `true` or `false`
228
-
-`array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
229
-
-`null`
230
-
-`undefined`
231
-
The values `null` and `undefined` are very similar in JavaScript, but they behave a bit differently. The difference is that `null` always has type "object", and `undefined` always has type "undefined".
239
+
-`array`, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
240
+
-`null`\*
241
+
-`undefined`\*
242
+
-`symbol` e.g. `new Symbol('example')`
232
243
244
+
\* The values `null` and `undefined` are very similar in JavaScript, but they behave a bit differently. The difference is that `null` always has type "object", and `undefined` always has type "undefined".
233
245
Whenever you declare a variable (using `let`), but you don't set a value, the variable will become `undefined`. JavaScript will never make a variable `null` unless you explicitly program it.
234
246
235
-
-`symbol`
236
-
237
-
```js
238
-
let x =5;
239
-
let typeOfX =typeof x; // -> "number"
240
-
```
241
-
242
247
### Exercise
243
248
244
-
Everybody has two minutes to find a way to declare all basic data types by making use of the typeof operator:
249
+
Everybody has four minutes to find a way to store all basic data types in a variable by making use of the typeof operator:
245
250
246
251
```js
247
252
let x =5;
248
253
let typeOfX =typeof x; // -> "number"
249
254
```
250
255
251
-
#####Essence
256
+
### Essence
252
257
253
258
In this way we can store a lot of data in a compact way, while the computer/compiler knows how to interpret the 1's and 0's/
254
259
255
260
## 5. The compound data types (object, array)
256
261
257
262
### Explanation
258
263
259
-
- Object key / value
260
-
- Array numeric key value
261
-
- Array ordered
262
-
- Object not ordered
264
+
Pieces of information often form a group. For example the names of all the students in this class can be grouped together
265
+
as a list. In JavaScript lists are stored in a datatype called an `Array`.
266
+
267
+
Another way pieces of information can form a group are multiple properties of the same thing. For example the dimensions
268
+
of this room: length, width, height. These groups of information are stored in a datatype called an `Object`.
263
269
264
270
### Example
265
271
266
-
-`array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
267
-
-`object`, e.g. `{name: 'John', age: 24}`, or the special object `null`
272
+
-`array`\*, e.g. `[1, 2, 3]` or `['Gijs', 'Jim', 'Noer', 'Wouter']`
273
+
-`object`, e.g. `{name: 'Wilgert', shoeSize: 42}`, or the special object `null`
268
274
269
275
### Exercise
270
276
271
277
1. Create a list of your favorite types of food/dishes like this:
272
278
273
279
```js
274
-
['Chocolate', 'Risotto', 'Tuna melt'];
280
+
constfoods=['Chocolate', 'Risotto', 'Tuna melt'];
275
281
```
276
282
277
283
2. Create an object that contains the properties of your town/city like this:
278
284
279
285
```js
280
-
{
286
+
constcity={
281
287
name:'Huizen',
282
288
province:'Noord-Holland',
283
-
citizens:50000
284
-
}
289
+
population:50000,
290
+
capital:false,
291
+
};
285
292
```
286
293
287
294
### Essence
288
295
289
-
_Special thanks to Jim Cramer, Yash Kapila, David Nudge for most of the content_
0 commit comments