Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dc0cd43

Browse files
committed
Control Flow - Status: DONE
1 parent e617b30 commit dc0cd43

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

‎08-Control-Flow.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
**Table of Content**
2+
3+
- [Conditional Statement](#conditional-statement)
4+
- [`if` statement](#if-statement)
5+
- [`else` statement](#else-statement)
6+
- [`else-if` statement](#else-if-statement)
7+
- [switch](#switch)
8+
- [Exception Handling](#exception-handling)
9+
- [Catching Exceptions](#catching-exceptions)
10+
- [JavaScript Error Types](#javascript-error-types)
11+
- [Throwing Custom Exceptions](#throwing-custom-exceptions)
12+
113
# Conditional Statement
214

315
Conditional Statements control behavior in JavaScript and determine weather certain code blocks can run or not. There are different conditional statements in JavaScript such as -

‎09-JavaScript-Operators.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Expression and Operators
2+
3+
An expression is a valid piece of code that resolves to a value. There are two types of expressions: those that have effects such as asssigning the value and those who evaluate value.
4+
5+
For example: `x = 7` is a expression that assigns the value of 7 to the variable `x` usig the `=` operator while the expression `2+2` uses the operator `+` to add 2 and 2 together and returns a value of 4.
6+
7+
## Types of Operator
8+
9+
- Assignment Operator: It assigns a value to its left operand to the value at its right operand with the operator `=`.
10+
- Comparision Operator: It compares its operands and returns a logical value based on whether the comparision is `true` or `false`. If two operands are not of same type, JS attempts to convert them to appropriate type for comparision.
11+
12+
| Operator | Description |
13+
| -------------------------- | --------------------------------------------------------------------------------------------------- |
14+
| Equal (==) | Returns true if the operands are equal. |
15+
| Not equal (!=) | Returns true if the operands are not equal. |
16+
| Strict equal (===) | Returns true if the operands are equal and of the same type. See also Object.is and sameness in JS. |
17+
| Strict not equal (!==) | Returns true if the operands are of the same type but not equal, or are of different type. |
18+
| Greater than (>) | Returns true if the left operand is greater than the right operand. |
19+
| Greater than or equal (>=) | Returns true if the left operand is greater than or equal to the right operand. |
20+
| Less than (<) | Returns true if the left operand is less than the right operand. |
21+
| Less than or equal (<=) | Returns true if the left operand is less than or equal to the right operand. |
22+
23+
- Arithematic Operator: It takes numerical values as operands and returns single numerical value.The standard arithematic operations are addition `(+)`, subtraction `(-)`, multiplication `(*)` and division `(/)`.
24+
25+
```js
26+
20 / 2; //10
27+
2 + 2; //4
28+
10 * 2; //20
29+
```
30+
31+
In addition to the standard arithematic operations `(+,-,*,/)`, JS also provides other arithematic operators.
32+
33+
| Operator | Description |
34+
| -------------------------- | ------------------------------------------------------------------------------------------ |
35+
| Equal (==) | Returns true if the operands are equal. |
36+
| Not equal (!=) | Returns true if the operands are not equal. |
37+
| Strict equal (===) | Returns true if the operands are equal and of the same type. |
38+
| Strict not equal (!==) | Returns true if the operands are of the same type but not equal, or are of different type. |
39+
| Greater than (>) | Returns true if the left operand is greater than the right operand. |
40+
| Greater than or equal (>=) | Returns true if the left operand is greater than or equal to the right operand. |
41+
| Less than (<) | Returns true if the left operand is less than the right operand. |
42+
| Less than or equal (<=) | Returns true if the left operand is less than or equal to the right operand. |
43+
44+
- Bitwise Operator: Bitwise operator treats their operands as a set of 32 bits (1s and 0s). For example, the decimal `7` has a binary represntation of `111`. Bitwise operators perform their operations on such binary representations but they return numerical values.
45+
46+
| Operator | Description |
47+
| --------------------- | ------------------------------------------------------------------------------------------------ |
48+
| Bitwise AND (`a & b`) | Returns a one in each bit position for which the corresponding bits of both operands are ones. |
49+
| Bitwise OR (`a \| b`) | Returns a zero in each bit position for which the corresponding bits of both operands are zeros. |
50+
| Bitwise XOR (`a ^ b`) | Returns a zero in each bit position for which the corresponding bits are the same. |
51+
| Bitwise NOT (`~ a`) | Inverts the bits of its operand. |
52+
53+
- Logical Operator: They are typically used with boolean values however `&&` and `||` operators actually return the value of one of the specified operands,so if the operands are used with non-boolean values, they may return non-boolean values.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /