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
+53-27Lines changed: 53 additions & 27 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
@@ -60,7 +61,7 @@ Discuss in class which claim belongs to which type of website:
60
61
61
62
Dynamic:
62
63
Advantage:
63
-
- Easy to pull in data on structured and organised way
64
+
- Easy to pull in data on stuctured and organised way
64
65
- Content management system
65
66
Disadvantage:
66
67
- Design is more fixed, because the pages are more of a template
@@ -73,13 +74,17 @@ Discuss in class which claim belongs to which type of website:
73
74
- HTML defines what the content is.
74
75
- CSS defines the appearance of the page.
75
76
- JavaScript defines behavior of the page.
77
+
- Where can JavaScript run:
78
+
- browser
79
+
- Node
76
80
77
81
### Example
78
82
79
83
- 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/
80
84
81
85
### Exercise
82
86
87
+
Let students fork and then clone the repository.
83
88
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).
84
89
85
90
The end result should look like:
@@ -101,9 +106,9 @@ A big disadvantage of web pages like this is that the only way that a visitor ha
101
106
It doesn't exhibit any dynamic behavior like:
102
107
103
108
1. reacting to user actions such as mouse click events or key presses.
104
-
1. rendering complex animations
105
-
1. sending requests over network to servers and fetching a response
106
-
1. and this is where JavaScript steps in.
109
+
2. rendering complex animations
110
+
3. sending requests over network to servers and fetching a response
111
+
4. and this is where JavaScript steps in.
107
112
108
113
## 3. What are variables (const & let) & naming conventions
109
114
@@ -143,8 +148,10 @@ console.log(age);
143
148
144
149
```javascript
145
150
// Variable Initialization
151
+
146
152
var firstName ="Yash";
147
153
let lastName ="Kapila";
154
+
148
155
constage=29;
149
156
150
157
console.log(firstName);
@@ -171,12 +178,13 @@ console.log(lastName);
171
178
172
179
1. Create 2 variables using the `let` keyword
173
180
174
-
1. make 1 variable contain your first name
175
-
1. the second variable should have no value assigned
181
+
- make 1 variable contain your first name
182
+
- the second variable should have no value assigned
176
183
177
184
1. Make 2 variables using the `const` keyword
178
-
1. the first variable should contain the city you currently stay at
179
-
1. come up with a value for the second variable yourself
185
+
- the first variable should contain the city you currently stay at
186
+
- 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.
196
-
197
-
There are 5 different types of data. The compiler/computer interprets all the variables we make as one of those data types.
198
-
(https://javascript.info/types)
203
+
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`.
199
204
200
205
Boolean — true or false
201
206
Null — no value
202
207
Undefined — a declared variable but hasn’t been given a value
203
208
Number — integers, floats, etc
204
209
String — an array of characters i.e words
205
-
?? Symbol — a unique value that's not equal to any other value ??
210
+
Symbol — a unique value that's not equal to any other value (not used during HYF)
206
211
207
212
### Example
208
213
209
214
-`string`, e.g. "HackYourFuture"
210
215
-`number`, e.g. 5, or 10.6
211
216
-`boolean`, e.g. `true` or `false`
212
-
-`array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
213
-
-`null and undefined` 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".
214
-
215
-
Whenever you declare a variable, but you don't set a value, the variable will become `undefined`. JavaScript will never make a variable `null` unless you explicitly program it.
217
+
-`array`, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
218
+
-`null`\*
219
+
-`undefined`\*
220
+
-`symbol` e.g. `new Symbol('example')`
216
221
217
-
-`symbol`
218
-
219
-
```js
220
-
let x =5;
221
-
let typeOfX =typeof x; // -> "number"
222
-
```
222
+
\* 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".
223
+
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.
223
224
224
225
### Exercise
225
226
226
-
Everybody has two minutes to find a way to declare all basic data types by making use of the typeof operator:
227
+
228
+
Everybody has four minutes to find a way to store all basic data types in a variable by making use of the typeof operator:
227
229
228
230
```js
229
231
let x =5;
@@ -238,13 +240,37 @@ In this way we can store a lot of data in a compact way, while the computer/comp
238
240
239
241
### Explanation
240
242
243
+
Pieces of information often form a group. For example the names of all the students in this class can be grouped together
244
+
as a list. In JavaScript lists are stored in a datatype called an `Array`.
245
+
246
+
Another way pieces of information can form a group are multiple properties of the same thing. For example the dimensions
247
+
of this room: length, width, height. These groups of information are stored in a datatype called an `Object`.
248
+
241
249
### Example
242
250
243
-
-`array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
244
-
-`object`, e.g. `{name: 'John', age: 24}`, or the special object `null`
251
+
-`array`\*, e.g. `[1, 2, 3]` or `['Gijs', 'Jim', 'Noer', 'Wouter']`
252
+
-`object`, e.g. `{name: 'Wilgert', shoeSize: 42}`, or the special object `null`
245
253
246
254
### Exercise
247
255
256
+
1. Create a list of your favorite types of food/dishes like this:
0 commit comments