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

Skip to content

Commit 3d2b465

Browse files
authored
Update LESSONPLAN.md
1 parent e4ce648 commit 3d2b465

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

Week2/LESSONPLAN.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ if() {
157157
```
158158

159159
The switch statement can sometimes be a useful alternative to a concatenation of if statements. This is the case when the condition is an expression that can be decomposed into a number of distinct values or cases, as shown in the example below.
160+
Depending on the value of the expression specified in the `switch` clause, one of the `case` statement blocks is executed. Each statement block should end with a `break` statement to ensure that a `case` doesn't 'fall through' into the next `case`.
161+
162+
The `default` statement at the end is executed when none of the preceding cases hold true. The `default` statement is not strictly required, but is a best practice to always specify one.
160163

161164
### Example
162165
```js
@@ -165,6 +168,40 @@ if (distance < 10) {
165168
}
166169
```
167170

171+
```js
172+
const hyfModule = 'JavaScript-1';
173+
174+
switch (hyfModule) {
175+
case 'HTML/CSS':
176+
console.log('In this module you will learn HTML and CSS.');
177+
break;
178+
case 'JavaScript-1':
179+
console.log('In this module you will learn Git and JavaScript basics.');
180+
break;
181+
case 'JavaScript-2':
182+
console.log('In this module you will learn about JavaScript in the browser with HTML and CSS.');
183+
break;
184+
case 'JavaScript-3':
185+
console.log('In this module you will learn about Async and API calls.');
186+
break;
187+
case 'Node':
188+
console.log('This module is about building server and CLI applications using Node.');
189+
break;
190+
case 'Database':
191+
console.log('In this module is about Relational and Non-Relational Data and Database Systems.');
192+
break;
193+
case 'React':
194+
console.log('In this module you will to build Single Page Applications using React.');
195+
break;
196+
case 'Project':
197+
console.log('In this final module you will do your graduation project.');
198+
break;
199+
default:
200+
console.log('This module is unknown: ' + hyfModule);
201+
}}
202+
```
203+
204+
168205

169206
### Exercise
170207
https://developer.mozilla.org/nl/docs/Web/JavaScript/Reference/Statements/if...else

0 commit comments

Comments
 (0)