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

Skip to content

Commit c33de8e

Browse files
author
Noer Paanakker
committed
finished readings week 1
1 parent 7084d13 commit c33de8e

File tree

5 files changed

+127
-46
lines changed

5 files changed

+127
-46
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ If you have any questions or if something is not entirely clear ¯\\\_(ツ)\_/¯
3232

3333
## Planning
3434

35-
| Week | Topic | Reading Materials | Homework | Lesson Plan |
36-
| ---- | --------------------------------------------- | ------------------------------ | ------------------------------- | -------------------------------------- |
37-
| 1. | Document-Object Model (DOM), DOM manipulation | [Reading W1](/Week1/README.md) | [Homework W1](/Week1/MAKEME.md) | [Lesson Plan W1](/Week1/LESSONPLAN.md) |
38-
| 2. | Developer tools, Event Loop, Callbacks | [Reading W2](/Week2/README.md) | [Homework W2](/Week2/MAKEME.md) | [Lesson Plan W2](/Week1/LESSONPLAN.md) |
39-
| 3. | SPA vs. MPA, Scope, Closures | [Reading W3](/Week3/README.md) | [Homework W3](/Week3/MAKEME.md) | [Lesson Plan W3](/Week1/LESSONPLAN.md) |
35+
| Week | Topic | Reading Materials | Homework | Lesson Plan |
36+
| ---- | --------------------------------------------------- | ------------------------------ | ------------------------------- | -------------------------------------- |
37+
| 1. | Document-Object Model (DOM), DOM manipulation | [Reading W1](/Week1/README.md) | [Homework W1](/Week1/MAKEME.md) | [Lesson Plan W1](/Week1/LESSONPLAN.md) |
38+
| 2. | Developer tools, Web Storage, Event Loop, Callbacks | [Reading W2](/Week2/README.md) | [Homework W2](/Week2/MAKEME.md) | [Lesson Plan W2](/Week1/LESSONPLAN.md) |
39+
| 3. | SPA vs. MPA, Scope, Closures | [Reading W3](/Week3/README.md) | [Homework W3](/Week3/MAKEME.md) | [Lesson Plan W3](/Week1/LESSONPLAN.md) |
4040

4141
## Test
4242

Week1/README.md

Lines changed: 97 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,59 @@
44

55
These are the topics for week 1:
66

7-
1. What is a browser?
7+
1. What is a web browser?
88
- How a browser works
9-
- Different browsers
9+
- Different browsers work differently
1010
2. What is the Document-Object Model (DOM)?
1111
- JavaScript and the browser
1212
- The DOM
1313
- The Critical Rendering Path
1414
- Traversing the DOM
1515
3. What is DOM Manipulation?
16+
- Manipulating elements
1617
- Browser events
1718
- Event listeners and handlers
1819

1920
[DOM Crash Course](https://www.youtube.com/playlist?list=PLillGF-RfqbYE6Ik_EuXA2iZFcE082B3s)
2021

21-
## 1. What is a browser?
22+
## 1. What is a web browser?
2223

23-
A browser is software that allows you to access websites.
24+
A web browser is software that allows you to access websites.
2425

2526
### How a browser works
2627

27-
[How a web browser functions](https://www.youtube.com/watch?v=z0HN-fG6oT4)
28+
In your journey into becomeing a web developer it's important to know the tools you'll be using intimately. One such is the browser, which will be used to display your websites. In the following resources you'll learn about the many parts any web browser consists of and what their use is:
29+
30+
- [How a web browser functions](https://www.youtube.com/watch?v=z0HN-fG6oT4)
31+
- [How do web browsers work?](https://medium.com/@monica1109/how-does-web-browsers-work-c95ad628a509)
32+
33+
### Different browsers work differently
34+
35+
A website, ultimately is a set of instructions describing how a series of webpages should look. It's up to the browser to render it by reading the code from your HTML/CSS and JavaScript files. There are, however, differences in the code interpretation of the different browsers, thus making the output look differently.
36+
37+
That's why you should check the way your website looks on different browsers during the development of your website. This is called making it **cross browser compatible**>
38+
39+
You can use the following online tool in order see how your pages look on multiple browsers:
40+
41+
- [Browsershots](http://browsershots.org)
42+
43+
A good website should look and function the same in any browser.
44+
45+
Unfortunately, there is no easy solution for that. You should check the specificities of each browser that fails to display your website correctly and make the necessary adjustments to your code. Such compatibility issues may occur not only in different browsers but because of an old browser version which does not support completely the latest standards.
46+
47+
This is because browser development doesn't go at the same speed as programming language development. More often than not, the web technologies you're using will have more features you as a developer can make use of than the browser can currently handle. This is important to keep in mind.
48+
49+
When you do your styling, especially, it's important to know if a certain browser (and browser version) is even able to understand it. A helpful tool in identifying this is a website called **caniuse.com**:
50+
51+
- [caniuse](https://caniuse.com/)
52+
- [Check HTML5/CSS3 Support with CANIUSE.COM](https://www.youtube.com/watch?v=el7McMP8CB8)
53+
54+
Generally speaking, you want to support as many browsers (and browser versions) with your code as possible.
55+
56+
For more research, check out the following resources:
57+
58+
- [Dealing with Cross Browser Compatibility](https://www.youtube.com/watch?v=9tEixRJ3GeI)
59+
- [Understanding The Stacking Context for Cross Browser Compatibility](https://medium.com/@mattcroak718/understanding-the-stacking-context-for-cross-browser-compatibility-2b21db1cf621)
2860

2961
## 2. What is the Document-Object Model (DOM)?
3062

@@ -42,51 +74,97 @@ For our purposes, it's only important to understand that the browser looks at Ja
4274

4375
- [JavaScript, the Browser, and the DOM](https://www.youtube.com/watch?v=31ViueuIXGE)
4476

45-
## The DOM
77+
### The DOM
78+
79+
The Document-Object Model (DOM) is a tree-like representation of the structure of a webpage. The following is a simple example:
80+
81+
![Simple DOM](./../assets/simple-dom.png)
4682

4783
JavaScript is made accessible to the DOM by embedding it into an HTML file. You might've seen the <script></script> before; well, this is how the browser becomes aware of JavaScript.
4884

4985
- [What exactly is the DOM](https://bitsofco.de/what-exactly-is-the-dom/)
5086
- [JavaScript and the browser](https://eloquentjavascript.net/13_browser.html)
5187

52-
## The Critical Rendering Path
88+
### The Critical Rendering Path
5389

5490
The actual process of transforming HTML, CSS and JavaScript into a user-viewable version of a webpage is called **the Critical Rendering Path**.
5591

5692
- [Understanding the Critical Rendering Path](https://bitsofco.de/understanding-the-critical-rendering-path/)
5793

58-
### Traversing the DOM
94+
## 3. What is DOM Manipulation?
95+
96+
**DOM manipulation** refers to the activity of selecting and modifying DOM elements. The main reason why this is done is that **you want to show the user different things depending their activity**, for example:
97+
98+
- You click on a [hamburger menu icon](https://bit.ly/2Yr4O7Z) and a navigation menu slides in
99+
- You scroll down and the elements of
100+
101+
Finding the right elements is called **traversing the DOM**. Traversing the DOM essential means: using JavaScript to select certain elements within the DOM in order to modify them (change color, size or make them disappear, for example).
102+
103+
### Manipulating elements
104+
105+
Look at the following code sample:
106+
107+
```js
108+
const body = document.querySelector('body'); // you can also use 'document.body'
109+
const newParagraph = document.createElement('p');
110+
newParagraph.innerText = 'This paragraph will be added to the body!';
111+
newParagraph.style.background = 'red';
112+
body.appendChild(newParagraph);
113+
```
114+
115+
In this example we're executing the following steps:
59116

60-
Traversing the DOM essential means: using JavaScript to select certain elements within the DOM in order to modify them (change color, size or make them disappear, for example). The modification of elements is also known as **DOM manipulation**.
117+
1. We're first selecting the body: this is always necessary, as we can only add or remove elements from the body of the document
118+
2. Secondly, we're creating a new DOM element: a <p> element
119+
3. Thirdly, we're injecting content into the element
120+
4. Fourthly, we give our element a background color
121+
5. Finally, we add the <p> element in the body
61122

62-
Learning how to write JavaScript that targets the DOM is an essential part of being a web developer. In the following resources
123+
Test this code out by copying and pasting it in the Developer Console of your browser. After you've pressed the Enter/Return key you will find your new <p> at the end of the page!
124+
125+
Learning how to write JavaScript that targets the DOM is an essential part of being a web developer. In the following resources you'll more about how to do that:
63126

64127
- [Traversing the DOM with JavaScript](https://zellwk.com/blog/dom-traversals/)
65128
- [JavaScript DOM Crash Course - Part 2](https://www.youtube.com/watch?v=mPd2aJXCZ2g)
66129

67-
## 3. What is DOM Manipulation?
68-
69130
### Browser events
70131

71-
Browser events are very much like real-life events: they are important things that happen. In real-life this could be getting a job, graduating from school or receiving a birthday gift. In terms of the browser, this is much more small scale: user actions like `clicking`, `scrolling` or `typing` are all considered events.
132+
Browser events (also known as DOM events) are very much like real-life events: they are important things that happen. In real-life this could be getting a job, graduating from school or receiving a birthday gift. In terms of the browser, this is much more small scale: user actions like `clicking`, `scrolling` or `typing` are all considered events.
133+
134+
These events are important to know about, because based on those we manipulate the DOM. For example, user clicks on an image and as a result it increases in size.
72135

73-
These events are important to know about, because based on those we manipulate the DOM. It's cause and effect: user clicks on an image and as a result it, for example, increases in size.
136+
Effectively it's cause and effect.
137+
138+
Check out the following resources to learn more about what events there are, and what you can do to manipulate elements after an event has happened:
74139

75140
- [What are browser events?](https://www.youtube.com/watch?v=LeKKU3a4AQo)
141+
- [Introduction to browser events](https://javascript.info/introduction-browser-events)
76142
- [JavaScript DOM Crash Course - Part 3](https://www.youtube.com/watch?v=wK2cBMcDTss)
77143

78144
### Event listeners and handlers
79145

80-
The process of DOM manipulation happens in three steps:
146+
Take a look at this code:
147+
148+
```js
149+
const body = document.querySelector('body');
150+
body.addEventListener('click', function() {
151+
body.style.background = 'black';
152+
});
153+
```
154+
155+
Test this code out by copying and pasting it in the Developer Console of your browser. After you've pressed the Enter/Return click the website. You should see the whole <body> becoming black!
156+
157+
This is DOM manipulation in its simplest form. It goes in three essential steps:
81158

82-
(1) an event happens ("User clicks on a button")
83-
(2) JavaScript is aware and looking for this specific user action
84-
(3) JavaScript modifies the DOM as a result ("The button disappears and is replaced by an image")
159+
(1) An event happens ("User clicks on the page")
160+
(2) JavaScript is aware and looks for this specific user action (The browser is listening for the event*), in this case a `click` event)
161+
(3) JavaScript modifies the DOM as a result (\_A function that makes the body background color black is executed*)
85162

86-
The second step is called **listening for the event**. We do this by using a by the browser predefined function called `addEventListener()`, which we get from the `document` object.
163+
The second step is called **listening for the event**. We do this by using a by the browser predefined function called `addEventListener()`, which we get from the `document` object in the browser. The browser needs to listen to the event in order to know what it should do ("make the body background color black") in case a certain event (`click`) happens to a certain element (`body`).
87164

88165
The third and final step is called **handling the event**. The term "handler" effectively means "taking care of" the event; the response to the event. The handler itself is nothing more than a function that executes more JavaScript code in order to manipulate a particular part of the page (either the element that experienced the event or a totally different part of the page).
89166

167+
- [Events in JavaScript](https://www.youtube.com/watch?v=7UstS0hsHgI)
90168
- [JavaScript Events Tutorial](https://www.youtube.com/watch?v=e57ReoUn6kM)
91169

92170
## Finished?

Week2/MAKEME.md

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,7 @@
1111

1212
## **2. JavaScript exercises**
1313

14-
## **3. Code along**
15-
16-
- [Building a Real-World Application](https://www.youtube.com/watch?v=NYq9J-Eur9U)
17-
18-
## **4. PROJECT:**
19-
20-
```
21-
Topics discussed this week:
22-
• Functions + JSON/Arrays
23-
• Array Manipulations
24-
• JSON
25-
• Map and filter
26-
• Arrow functions
27-
```
28-
29-
> [Here](/Week3/README.md) you find the readings you have to complete before the third lecture.
30-
31-
## Step 1: More map, filter and `=>`
14+
# Step 1: More map, filter and `=>`
3215

3316
_Deadline Wednesday_
3417

@@ -114,6 +97,14 @@ Follow these steps. Each step should build on the result of the previous step.
11497
- Choose variable and parameters names that most accurately describe their contents or purpose. When naming an array, use a plural form, e.g. `durations`. For a single item, use a singular form, e.g. `duration`. For details, see [Naming Conventions](https://github.com/HackYourFuture/fundamentals/blob/master/fundamentals/naming_conventions.md).
11598
- Don't forget to use `=>`.
11699

100+
## **3. Code along**
101+
102+
- [Building a Real-World Application](https://www.youtube.com/watch?v=NYq9J-Eur9U)
103+
104+
## **4. PROJECT:**
105+
106+
#
107+
117108
## Step 2: Testing your homework
118109

119110
We have provided _unit tests_ in this repo that allow you to verify that your homework produces the expected results.

Week2/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@
44

55
These are the topics for week 3:
66

7-
1. Web Storage
7+
1. Callbacks
88
2. Event Loop
9-
3. Callbacks
9+
3. Developer Tools
10+
4. Web Storage
1011

11-
## 1. What is a library?
12+
## 1. Callbacks
1213

13-
## 2. What is jQuery?
14+
## 2. Event Loop
15+
16+
How does the browser know what to do first? This is where the Event Loop comes in.
17+
18+
For further study, check out the following resources
19+
20+
- [What the heck is an event loop?](https://www.youtube.com/watch?v=8aGhZQkoFbQ)
21+
- [JavaScript Event Loop](https://www.youtube.com/watch?v=XzXIMZMN9k4)
22+
23+
## 3. Developer Tools
24+
25+
- [Google Chrome Developer Tools Crash Course](https://www.youtube.com/watch?v=8aGhZQkoFbQ)
1426

1527
## Finished?
1628

assets/simple-dom.png

13.4 KB
Loading

0 commit comments

Comments
 (0)