Run prettier
This commit is contained in:
1 parent
d081ecf5b3
commit
7434ff71eb
2129 files changed
+10497
-7961
No files matched your search
-1
@@ -5,4 +5,3 @@ These are ways of handling errors in your JavaScript code. Inside the try code b
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [JavaScript Errors](https://www.w3schools.com/js/js_errors.asp)
|
||||
|
||||
+3
-2
@@ -3,11 +3,12 @@
|
||||
The `if` statement executes a statement if a specified condition is `truthy`. If the condition is `falsy`, another statement in the optional `else` clause will be executed.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
if (condition) {
|
||||
statement1
|
||||
statement1;
|
||||
} else {
|
||||
statement2
|
||||
statement2;
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
+6
-5
@@ -3,22 +3,23 @@
|
||||
The `switch` statement evaluates an expression, matching the expression's value against a series of `case` clauses, and executes statements after the first `case` clause with a matching value, until a `break` statement is encountered. The `default` clause of a `switch` statement will be jumped to if no `case` matches the expression's value.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
switch (expression) {
|
||||
case value1:
|
||||
//Statements executed when the result of expression matches value1
|
||||
break;
|
||||
break;
|
||||
case value2:
|
||||
//Statements executed when the result of expression matches value2
|
||||
break;
|
||||
break;
|
||||
...
|
||||
case valueN:
|
||||
//Statements executed when the result of expression matches valueN
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
//Statements executed when none of the values match the value of the expression
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
```
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Conditional statements
|
||||
# Conditional statements
|
||||
|
||||
When you write code, you often want to perform different actions for different decisions. You can use conditional statements in your code to do this. In JavaScript, we have three conditional statements: `if`, `if...else`, and `switch`.
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
In JavaScript, the `Control flow` is a way of how your computer runs code from top to bottom. It starts from the first line and ends at the last line unless it hits any statement that changes the control flow of the program such as loops, conditionals, etc.
|
||||
|
||||
We can control the flow of the program through any of these control structures:
|
||||
|
||||
- Sequential (default mode)
|
||||
- Conditional Statements
|
||||
- Exception Handling
|
||||
- Exception Handling
|
||||
- Loops and Iterations
|
||||
|
||||
|
||||
Visit the following resources to learn more:
|
||||
|
||||
- [Control Flow - MDN](https://developer.mozilla.org/en-US/docs/Glossary/Control_flow)
|
||||
- [Control Flow - MDN](https://developer.mozilla.org/en-US/docs/Glossary/Control_flow)
|
||||
Reference in new issue
Block a user