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
+44-2Lines changed: 44 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -189,8 +189,50 @@ Variables are simply named storage/pointer for this information.
189
189
190
190
#### 4. The basic data types (string, boolean, number, undefined, null)
191
191
192
-
TODO
192
+
##### Explanation
193
+
Primitive data types are typically types that are built-in or basic to a language implementation.
194
+
195
+
There are 5 different types of data. The compiler/computer interpretates all the variables we make as one of those datatypes.
196
+
(https://javascript.info/types)
197
+
198
+
Boolean — true or false
199
+
Null — no value
200
+
Undefined — a declared variable but hasn’t been given a value
201
+
Number — integers, floats, etc
202
+
String — an array of characters i.e words
203
+
?? Symbol — a unique value that's not equal to any other value ??
204
+
##### Example
205
+
*`string`, e.g. "HackYourFuture"
206
+
*`number`, e.g. 5, or 10.6
207
+
*`boolean`, e.g. `true` or `false`
208
+
*`array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
209
+
*`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".
210
+
211
+
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.
212
+
*`symbol`
213
+
214
+
215
+
```js
216
+
let x =5;
217
+
let typeOfX =typeof x; // -> "number"
218
+
```
219
+
220
+
221
+
##### Exercise
222
+
BEverybody has two minutes to find a way to declare all basic data types by making use of the typeof operator:
223
+
```js
224
+
let x =5;
225
+
let typeOfX =typeof x; // -> "number"
226
+
```
227
+
##### Essence
228
+
In this way we can store a lot of data in a compact way, while the computer/compiler knows how to interpretate the 1's and 0's/
193
229
194
230
#### 5. The compound data types (object, array)
195
231
196
-
TODO
232
+
##### Explanation
233
+
234
+
##### Example
235
+
*`array`\*, e.g. `[1, 2, 3]` or `['what', 'is', 'your', 'name']`
236
+
*`object`, e.g. `{name: 'John', age: 24}`, or the special object `null`
0 commit comments