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

Skip to content

Commit fb0abfd

Browse files
authored
Merge pull request HackYourFuture#190 from HackYourFuture/js1-week1-lesson-plan-improvements
updates what/why/how for variables
2 parents effbfbb + 6214f93 commit fb0abfd

File tree

1 file changed

+93
-12
lines changed

1 file changed

+93
-12
lines changed

Week1/LESSONPLAN.md

Lines changed: 93 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@ The purpose of this class is to introduce to the student:
1818
#### 1. The 2 types of websites: static vs. dynamic
1919

2020
##### Explanation
21+
2122
Static websites usually come with a fixed number of pages that have a specific layout. When the page runs on a browser, the content is literally static and doesn’t change in response to user actions. A static website is usually created with HTML and CSS
2223
Compared to static websites, which are purely informational, a dynamic website is more functional. It allows users to interact with the information that is listed on the page. Of course, that requires utilizing more than just HTML code.
2324

2425
##### Example
26+
2527
Examples the two different kind of websites
28+
2629
- Static: https://www.atlassian.com/time-wasting-at-work-infographic
2730
- Dynamic: https://www.facebook.com/
2831

29-
3032
##### Exercise
31-
Discuss in class which claim belongs to wich type of website:
33+
34+
Discuss in class which claim belongs to which type of website:
3235

3336
Content of Web pages can not be change at runtime.
3437
Server side languages such as PHP, Node.js are used.
@@ -44,7 +47,8 @@ Discuss in class which claim belongs to wich type of website:
4447
Same content is delivered everytime the page is loaded.
4548

4649
##### Essence
47-
[In the link is an article with (dis)advantages of both static and dynamic websites.](https://www.spiderwriting.co.uk/static-dynamic.php)
50+
51+
[In the link is an article with (dis)advantages of both static and dynamic websites.](https://www.spiderwriting.co.uk/static-dynamic.php)
4852

4953
Static:
5054
Advantage:
@@ -67,23 +71,34 @@ _Show examples of static and dynamic websites_
6771
#### 2. The pillars of web development: HTML/CSS/JavaScript
6872

6973
##### Explanation
74+
7075
- HTML defines what the content is.
7176
- CSS defines the appearance of the page.
7277
- JavaScript defines behavior of the page.
7378

7479
##### Example
80+
7581
- An example about relationship between HTML, CSS and Javascript using a methaphor of building a city: https://blog.codeanalogies.com/2018/05/09/the-relationship-between-html-css-and-javascript-explained/
7682

7783
##### Exercise
78-
84+
85+
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).
86+
87+
The end result should look like:
88+
89+
```
90+
- js1-week1-classwork
91+
- index.html
92+
- app.js
93+
```
94+
7995
##### Essence
80-
Up until now at HackYourFuture, we have been writing websites using HTML and CSS.
81-
Even though a website written with these two languages works just fine, it is only a static page.
8296

83-
These static pages can interact with a visitor only through the use of forms. Once a form is filled out and submitted,
84-
a request is sent back to the server where a new static web page is constructed and eventually downloaded into the browser.
97+
Up until now at HackYourFuture, we have been writing websites using HTML and CSS. Even though a website written with these two languages works just fine, it is only a static page.
98+
99+
These static pages can interact with a visitor only through the use of forms. Once a form is filled out and submitted, a request is sent back to the server where a new static web page is constructed and eventually downloaded into the browser.
85100

86-
The big disadavantage 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.
101+
A big disadavantage 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.
87102

88103
It doesn't exhibit any dynamic behaviour like:
89104

@@ -96,14 +111,80 @@ It doesn't exhibit any dynamic behaviour like:
96111

97112
##### Explanation
98113

99-
**Do Exercise**
114+
In JavaScript, there are three ways of creating variables.
115+
116+
- var
117+
- let
118+
- const
119+
120+
While `var` has been used in JavaScript for a long period of time, `let` and `const` are recent additions having been introduced in ES6.
121+
122+
Three different stages of working with variables are:
123+
124+
- Variable Declaration
125+
- Declaration means creating a variable and providing it with a name. During the whole program, a variable can be declared only once.
126+
- Variable Initialization
127+
- Initialization is declaring a variable and assigning it an initial value at the time of declaration. By default, all variables created in JavaScript have undefined as the default value unless explicitly given a different value.
128+
- Variable (Re)Assignment
129+
- Variable assignment means throwing away the old value of a variable and replacing it with a new one. Initialization can be thought of as a special way of assignment.
130+
131+
##### Example
132+
133+
```javascript
134+
// Variable Declaration
135+
var firstName;
136+
let lastName;
137+
const age; // is this correct???
138+
139+
console.log(firstName);
140+
console.log(lastName);
141+
console.log(age);
142+
```
143+
144+
```javascript
145+
// Variable Initialization
146+
var firstName = 'Yash';
147+
let lastName = 'Kapila';
148+
const age = 29;
149+
150+
console.log(firstName);
151+
console.log(lastName);
152+
console.log(age);
153+
```
154+
155+
```javascript
156+
var firstName = 'Tom';
157+
let lastName = 'Hanks';
158+
159+
console.log(firstName);
160+
console.log(lastName);
161+
162+
// Assigning variables to a different value
163+
firstName = 'Hanks';
164+
lastName = 'Tom';
165+
166+
console.log(firstName);
167+
console.log(lastName);
168+
```
169+
170+
##### Exercise
171+
172+
TODO(Could be moved to SECOND HALF)
173+
174+
##### Essence
175+
176+
Any application written in any programming language requires data or information to work with. This information can be as simple as a string, number or complex types like a list of strings, a mix of strings and numbers etc.
177+
178+
For eg, you name and age are simple pieces of information, strings and a number respectively. On the other hand, your house address could be considered as a complex set of information including house number, street name, city, postcode and country.
179+
180+
Variables are simply named storage/pointer for this information.
100181

101182
### SECOND HALF (14.00 - 16.00)
102183

103184
#### 4. The basic data types (string, boolean, number, undefined, null)
104185

105-
**Do Exercise**
186+
TODO
106187

107188
#### 5. The compound data types (object, array)
108189

109-
**Do Exercise**
190+
TODO

0 commit comments

Comments
 (0)