Skip to content

Commit fc0b62b

Browse files
committed
some fixes
1 parent 73a4005 commit fc0b62b

2 files changed

Lines changed: 30 additions & 12 deletions

File tree

03_Day/03_booleans_operators_date.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- [Logical Operators](#logical-operators)
1818
- [Increment Operator](#increment-operator)
1919
- [Decrement Operator](#decrement-operator)
20-
- [Ternary Operators](#ternary-operators)
20+
- [Ternary Operators](#ternary-operators)
2121
- [Operator Precendence](#operator-precendence)
2222
- [Window Methods](#window-methods)
2323
- [Window alert() method](#window-alert-method)
@@ -204,7 +204,9 @@ console.log('python'.length > 'dragon'.length) // false
204204
```
205205

206206
Try to understand the above comparisons with some logic. Remember without any logic might be difficult.
207-
JavaScript is some how a wired kind of programming language. JavaScript code run and give you a result but unless you are good at it may not be the desired result. The following [link](https://dorey.github.io/JavaScript-Equality-Table/) has an exhaustive list of comparison of data types.
207+
JavaScript is some how a wired kind of programming language. JavaScript code run and give you a result but unless you are good at it may not be the desired result.
208+
209+
As rule of thumb, if a value is not true with == it will not be equall with ===. Using === is safer than using ===. The following [link](https://dorey.github.io/JavaScript-Equality-Table/) has an exhaustive list of comparison of data types.
208210

209211
### Logical Operators
210212

@@ -278,7 +280,7 @@ console.log(count--) // 0
278280
console.log(count) // -1
279281
```
280282

281-
#### Ternary Operators
283+
### Ternary Operators
282284

283285
Ternary operator allows to write a condition.
284286
Another way to write conditionals is using ternary operators. Look at the following examples:

04_Day/04_day_conditionals.md

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
## Table of Contents
22

3-
[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_day_booleans_operators_date.md) | [Day 5 >>](#)
3+
[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_booleans_operators_date.md) | [Day 5 >>](#)
44
--
55

66
![Thirty Days Of JavaScript](./day_1_4.png)
77

88
- [📔 Day 4](#%f0%9f%93%94-day-4)
99
- [Conditionals](#conditionals)
10-
- [If](#if)
11-
- [If Else](#if-else)
12-
- [If else if else](#if-else-if-else)
10+
- [if](#if)
11+
- [if else](#if-else)
12+
- [if else if else](#if-else-if-else)
1313
- [Switch](#switch)
1414
- [Ternary Operators](#ternary-operators)
1515
- [💻 Exercise - 8 : Conditionals](#%f0%9f%92%bb-exercise---8--conditionals)
@@ -32,7 +32,7 @@ Conditions can be implementing using the following ways:
3232
- switch
3333
- ternary operator
3434

35-
### If
35+
### if
3636

3737
In JavaScript and other programming languages the key word _if_ use to check if a condition is true and to execute the block code. To create an if condition, we need _if_ keyword, condition inside a parenthesis and block of code inside a curly bracket({}).
3838

@@ -62,7 +62,7 @@ if (isRaining) {
6262

6363
As you can see in the above condition, 3 is greater than 0 and it is a positive number. The condition was true and the block code was executed. However, if the condition is false, we do not see a result. The same goes for the second condition, if isRaining is false the if block will not be executed and we do not see an output. In order to see the result of the falsy condition, we should have another block, which is going to be _else_.
6464

65-
### If Else
65+
### if else
6666

6767
If condition is true the first block will be executed, if not the else condition will be executed.
6868

@@ -113,7 +113,7 @@ if (isRaining) {
113113

114114
The above condition is false, therefore the else block was executed. How about if our condition is more than two, we will use *else if* conditions.
115115

116-
### If else if else
116+
### if else if else
117117

118118
On our daily life, we make decision on daily basis. We make decision not by checking one or two conditions instead we make decisions based on multiple conditions. As similar to our daily life, programming is also full conditions. We use *else if* when we have multiple conditions.
119119

@@ -160,7 +160,23 @@ if (weather === 'rainy') {
160160

161161
### Switch
162162

163-
Switch is an alternative for **if else if else else**
163+
Switch is an alternative for **if else if else else**.
164+
The switch statement starts with a switch keyword followed by a parenthesis and code block. Inside the code block we will have different cases. Case block run if the value in the switch statement parenthesis match with the case vale. The break is to terminate and it does not go down after the condition is satisfied. The default block run if all the cases don't satisfy the condition.
165+
166+
```js
167+
switch(caseValue){
168+
case 1:
169+
// code
170+
break
171+
case 2:
172+
// code
173+
break
174+
case 3:
175+
// code
176+
default:
177+
// code
178+
}
179+
```
164180

165181
```js
166182
let weather = 'cloudy'
@@ -309,4 +325,4 @@ isRaining
309325

310326
🎉 CONGRATULATIONS ! 🎉
311327

312-
[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_day_booleans_operators_date.md) | [Day 5 >>](#)
328+
[<< Day 3](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/03_Day/03_booleans_operators_date.md) | [Day 5 >>](#)

0 commit comments

Comments
 (0)