Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1597ced

Browse files
authored
Update LESSONPLAN.md
1 parent d300a10 commit 1597ced

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

Week3/LESSONPLAN.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,21 @@ FIRST HALF (12.00 - 13.30)
1414

1515
## 1. Q&A about last week's concepts & homework
1616

17-
### Explanation
18-
**Week 1**
19-
20-
In Week 1 we learnt about how data is represented computer programs:
21-
2217
- Variables
2318
- Basic data types (`string`, `number`, etc)
2419
- Compound data types (`array`, `object`)
25-
26-
**Week 2**
27-
28-
In Week 2 we learnt about how to manipulate the flow of execution in computer programs:
29-
3020
- Branching constructs
3121
- `if..else`
3222
- Looping constructs
3323
- `for`
3424
- `for..of`
3525
- `for..in`
3626
- `do..while`
37-
38-
We also learnt about more ways to work with data using operators:
39-
4027
- Operators (arithmetic, comparison, eg `+`, `*`, `&&`, `||`, etc).
4128

42-
### Example
43-
### Exercise
44-
Ask students to explain a concept or summerise the last lecture themselves
45-
### Essence
29+
Note: You can ask students to explain a concept or summerise the last lecture themselves
4630

47-
## 2. What is a function (ES5 only)
31+
## 2. Function (ES5 only)
4832

4933
### Explanation
5034
Functions are a way to organize your code in to re-usable chunks.
@@ -66,15 +50,27 @@ And the same link as Explanation
6650

6751
SECOND HALF (14.00 - 16.00)
6852

69-
## 3. Wat is scope (global, functional, block)
53+
## 3. Scope (global, functional, block)
7054

7155
### Explanation
7256
Scopes define the visiblity of declarations of variables and functions.
7357

74-
The top level outside all your functions is called the _global scope_. Values defined in the global scope are accessible from everywhere in the code.
58+
The top level outside all your functions is called the _global scope_. Values defined in the global scope are accessible from everywhere in the code. Whereas, variables defined in local scope can only be accessed and altered inside the scope they were created.
7559

7660
- `var` and `function` declarations are visible with function scope.
77-
- `let` and `const` declarations are visible with block scope.
61+
- `let` and `const` declarations are visible with block scope. A block can be seen as a set of statements enclosed in curly brackets({}).
62+
63+
Global scope:
64+
65+
- Can be a real useful tool or a nightmare.
66+
- Useful in scenarios where we want to export JS modules, use third party libraries like jQuery etc.
67+
- Big risk of causing namespace clashes with multiple variables with same name being created in different places.
68+
69+
Local Scope:
70+
71+
- Think of local scope as any new scope that is created within the global scope.
72+
- Each function written in JavaScript creates a new local scope.
73+
- Variables defined within a function aren't available outside it. They are created when a function starts and are _in a way_ destroyed/hidden when a function ends.
7874

7975
https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/scope.md
8076
### Example

0 commit comments

Comments
 (0)