Skip to content

Commit a47f48f

Browse files
committed
day 14
1 parent ac2ff0d commit a47f48f

File tree

3 files changed

+123
-102
lines changed

3 files changed

+123
-102
lines changed

03_Day/03_booleans_operators_date.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ let isLightOn = true
6464
let isRaining = false
6565
let isHungry = false
6666
let isMarried = true
67-
let truValue = 4 > 3 // true
68-
let falseValue = 3 < 4 // false
67+
let truValue = 4 > 3 // true
68+
let falseValue = 4 < 3 // false
6969
```
7070

7171
We agreed that boolean values are either true or false.

11_Day/11_day_destructuring_and_spread.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</sub>
1414
</div>
1515

16-
[<< Day 10](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/09_Day/09_day_Set_and_Map.md) | [Day 12>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md)
16+
[<< Day 10](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/10_Day/10_day_Set_and_Map.md) | [Day 12>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md)
1717

1818
![Day 11](../images/banners/day_1_11.png)
1919

@@ -691,4 +691,4 @@ const users = [
691691
```
692692
🎉 CONGRATULATIONS ! 🎉
693693

694-
[<< Day 10](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/09_Day/09_day_Set_and_Map.md) | [Day 12>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md)
694+
[<< Day 10](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/10_Day/10_day_Set_and_Map.md) | [Day 12>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md)

13_Day/13_day_console_object_methods.md

Lines changed: 119 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,17 @@
77
<img alt="Twitter Follow" src="https://img.shields.io/twitter/follow/asabeneh?style=social">
88
</a>
99

10-
<sub>Author:
11-
<a href="https://www.linkedin.com/in/asabeneh/" target="_blank">Asabeneh Yetayeh</a><br>
12-
<small> January, 2020</small>
13-
</sub>
10+
<sub>Author:
11+
<a href="https://www.linkedin.com/in/asabeneh/" target="_blank">Asabeneh Yetayeh</a><br>
12+
<small> January, 2020</small>
13+
</sub>
14+
1415
</div>
1516

16-
[<< Day 12](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md) | [Day 14>>](#)
17+
[<< Day 12](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md) | [Day 14>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_error_handling.md)
1718

1819
![Thirty Days Of JavaScript](../images/banners/day_1_13.png)
20+
1921
- [Day 13](#day-13)
2022
- [Console Object Methods](#console-object-methods)
2123
- [console.log()](#consolelog)
@@ -39,16 +41,16 @@
3941

4042
In this section, we will cover about console and console object methods. Absolute beginners usually do not know which to use: console.log(), document.write() or document.getElementById.
4143

42-
We use console object methods to show output on the browser console and we use document.write to show output on the browser document(view port). Both methods used only for testing and debugging purposes. The console method is the most popular testing and debugging tool on the browser. We use document.getElementById() when we like to interact with DOM try using JavaScript. We will cover DOM in another section.
44+
We use console object methods to show output on the browser console and we use document.write to show output on the browser document(view port). Both methods used only for testing and debugging purposes. The console method is the most popular testing and debugging tool on the browser. We use document.getElementById() when we like to interact with DOM try using JavaScript. We will cover DOM in another section.
4345

44-
In addition to the famous, console.log() method, the console provides other more methods methods.
46+
In addition to the famous, console.log() method, the console provides other more methods methods.
4547

4648
### console.log()
4749

4850
We use console.log() to show output on the browser console. We can substitute values and also we can style the logging out put using %c.
4951

5052
- Showing output on browser console
51-
53+
5254
```js
5355
console.log('30 Days of JavaScript')
5456
```
@@ -72,17 +74,26 @@ console.log('%d %s of JavaScript', 30, 'Days')
7274
We can style logging message using css. Copy the following code and paste it on browser console to see the result.
7375

7476
```js
75-
console.log('%c30 Days Of JavaScript','color:green') // log output is green
76-
console.log('%c30 Days%c %cOf%c %cJavaScript%c','color:green','', 'color:red', '', 'color:yellow') // log output green red and yellow text
77+
console.log('%c30 Days Of JavaScript', 'color:green') // log output is green
78+
console.log(
79+
'%c30 Days%c %cOf%c %cJavaScript%c',
80+
'color:green',
81+
'',
82+
'color:red',
83+
'',
84+
'color:yellow'
85+
) // log output green red and yellow text
7786
```
7887

7988
### console.warn()
8089

81-
We use console.warn() to give warning on browser. For instance to inform or warn deprecation of version of a package or bad practices. Copy the following code and paste it on browser console to see warning messages.
90+
We use console.warn() to give warning on browser. For instance to inform or warn deprecation of version of a package or bad practices. Copy the following code and paste it on browser console to see warning messages.
8291

8392
```js
8493
console.warn('This is a warning')
85-
console.warn('You are using React. Do not touch the DOM. Virtual DOM will take care of handling the DOM!')
94+
console.warn(
95+
'You are using React. Do not touch the DOM. Virtual DOM will take care of handling the DOM!'
96+
)
8697
console.warn('Warning is different from error')
8798
```
8899

@@ -110,77 +121,85 @@ Let us also check the result of an object. This creates table with two columns:a
110121

111122
```js
112123
const user = {
113-
name:'Asabeneh',
114-
title:'Programmer',
115-
country:'Finland',
116-
city:'Helsinki',
117-
age:250
124+
name: 'Asabeneh',
125+
title: 'Programmer',
126+
country: 'Finland',
127+
city: 'Helsinki',
128+
age: 250
118129
}
119130
console.table(user)
120131
```
121132

122133
Check the rest of the examples by copying and paste on the browser console.
123134

124135
```js
125-
const countries = [['Finland', 'Helsinki'], ['Sweden', 'Stockholm'], ['Norway', 'Oslo']]
136+
const countries = [
137+
['Finland', 'Helsinki'],
138+
['Sweden', 'Stockholm'],
139+
['Norway', 'Oslo']
140+
]
126141
console.table(countries)
127142
```
128143

129144
```js
130145
const users = [
131-
{
132-
name:'Asabeneh',
133-
title:'Programmer',
134-
country:'Finland',
135-
city:'Helsinki',
136-
age:250
137-
},
138-
{
139-
name:'Eyob',
140-
title:'Teacher',
141-
country:'Sweden',
142-
city:'London',
143-
age:25
144-
},
145-
{
146-
name:'Asab',
147-
title:'Instructor',
148-
country:'Norway',
149-
city:'Oslo',
150-
age:22
151-
},
152-
{
153-
name:'Matias',
154-
title:'Developer',
155-
country:'Denmark',
156-
city:'Copenhagen',
157-
age:28
158-
}
146+
{
147+
name: 'Asabeneh',
148+
title: 'Programmer',
149+
country: 'Finland',
150+
city: 'Helsinki',
151+
age: 250
152+
},
153+
{
154+
name: 'Eyob',
155+
title: 'Teacher',
156+
country: 'Sweden',
157+
city: 'London',
158+
age: 25
159+
},
160+
{
161+
name: 'Asab',
162+
title: 'Instructor',
163+
country: 'Norway',
164+
city: 'Oslo',
165+
age: 22
166+
},
167+
{
168+
name: 'Matias',
169+
title: 'Developer',
170+
country: 'Denmark',
171+
city: 'Copenhagen',
172+
age: 28
173+
}
159174
]
160175
console.table(users)
161176
```
162177

163178
### console.time()
179+
164180
Starts a timer you can use to track how long an operation takes. You give each timer a unique name, and may have up to 10,000 timers running on a given page. When you call console.timeEnd() with the same name, the browser will output the time, in milliseconds, that elapsed since the timer was started.
165181

166182
```js
167-
const countries = [['Finland', 'Helsinki'], ['Sweden', 'Stockholm'], ['Norway', 'Oslo']]
183+
const countries = [
184+
['Finland', 'Helsinki'],
185+
['Sweden', 'Stockholm'],
186+
['Norway', 'Oslo']
187+
]
168188

169189
console.time('Regular for loop')
170-
for(let i = 0; i < countries.length; i++) {
171-
console.log(countries[i][0], countries[i][1])
172-
190+
for (let i = 0; i < countries.length; i++) {
191+
console.log(countries[i][0], countries[i][1])
173192
}
174193
console.timeEnd('Regular for loop')
175194

176195
console.time('for of loop')
177-
for(const [name, city] of countries) {
196+
for (const [name, city] of countries) {
178197
console.log(name, city)
179198
}
180199
console.timeEnd('for of loop')
181200

182201
console.time('forEach loop')
183-
countries.forEach(([name, city])=> {
202+
countries.forEach(([name, city]) => {
184203
console.log(name, city)
185204
})
186205
console.timeEnd('forEach loop')
@@ -222,9 +241,9 @@ console.assert(4 > 3, '4 is greater than 3') // no result
222241
console.assert(3 > 4, '3 is not greater than 4') // Assertion failed: 3 is not greater than 4
223242

224243
for (let i = 0; i <= 10; i += 1) {
225-
let errorMessage = `${i} is not even`;
226-
console.log('the # is ' + i);
227-
console.assert(i % 2 === 0, {number: i, errorMessage: errorMessage})
244+
let errorMessage = `${i} is not even`
245+
console.log('the # is ' + i)
246+
console.assert(i % 2 === 0, { number: i, errorMessage: errorMessage })
228247
}
229248
```
230249

@@ -234,43 +253,47 @@ The console.group() can help to group different log groups. Copy the following c
234253

235254
```js
236255
const names = ['Asabeneh', 'Brook', 'David', 'John']
237-
const countries = [['Finland', 'Helsinki'], ['Sweden', 'Stockholm'], ['Norway', 'Oslo']]
256+
const countries = [
257+
['Finland', 'Helsinki'],
258+
['Sweden', 'Stockholm'],
259+
['Norway', 'Oslo']
260+
]
238261
const user = {
239-
name:'Asabeneh',
240-
title:'Programmer',
241-
country:'Finland',
242-
city:'Helsinki',
243-
age:250
262+
name: 'Asabeneh',
263+
title: 'Programmer',
264+
country: 'Finland',
265+
city: 'Helsinki',
266+
age: 250
244267
}
245268
const users = [
246-
{
247-
name:'Asabeneh',
248-
title:'Programmer',
249-
country:'Finland',
250-
city:'Helsinki',
251-
age:250
252-
},
253-
{
254-
name:'Eyob',
255-
title:'Teacher',
256-
country:'Sweden',
257-
city:'London',
258-
age:25
259-
},
260-
{
261-
name:'Asab',
262-
title:'Instructor',
263-
country:'Norway',
264-
city:'Oslo',
265-
age:22
266-
},
267-
{
268-
name:'Matias',
269-
title:'Developer',
270-
country:'Denmark',
271-
city:'Copenhagen',
272-
age:28
273-
}
269+
{
270+
name: 'Asabeneh',
271+
title: 'Programmer',
272+
country: 'Finland',
273+
city: 'Helsinki',
274+
age: 250
275+
},
276+
{
277+
name: 'Eyob',
278+
title: 'Teacher',
279+
country: 'Sweden',
280+
city: 'London',
281+
age: 25
282+
},
283+
{
284+
name: 'Asab',
285+
title: 'Instructor',
286+
country: 'Norway',
287+
city: 'Oslo',
288+
age: 22
289+
},
290+
{
291+
name: 'Matias',
292+
title: 'Developer',
293+
country: 'Denmark',
294+
city: 'Copenhagen',
295+
age: 28
296+
}
274297
]
275298

276299
console.group('Names')
@@ -285,7 +308,6 @@ console.group('Users')
285308
console.log(user)
286309
console.log(users)
287310
console.groupEnd()
288-
289311
```
290312

291313
### console.count()
@@ -294,7 +316,7 @@ It prints the number of time this console.count() is called. It takes a string l
294316

295317
```js
296318
const func = () => {
297-
console.count('Function has been called')
319+
console.count('Function has been called')
298320
}
299321
func()
300322
func()
@@ -311,27 +333,26 @@ Function has been called: 3
311333

312334
The console.clear() cleans the browser console.
313335

314-
🌕 Keep up the good work. Keep pushing, the sky is the limit! You have just completed day 13 challenges and you are 13 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
336+
🌕 Keep up the good work. Keep pushing, the sky is the limit! You have just completed day 13 challenges and you are 13 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
315337

316338
## Exercises
317339

318340
### Exercises:Level 1
319341

320-
1. Display the countries array as a table
321-
2. Display the countries object as a table
322-
3. Use console.group() to group logs
342+
1. Display the countries array as a table
343+
2. Display the countries object as a table
344+
3. Use console.group() to group logs
323345

324346
### Exercises:Level 2
325347

326-
1. 10 > 2 * 10 use console.assert()
348+
1. 10 > 2 \* 10 use console.assert()
327349
2. Write a warning message using console.warn()
328350
3. Write an error message using console.error()
329351

330352
### Exercises:Level 3
331353

332354
1. Check the speed difference among the following loops: while, for, for of, forEach
333355

334-
335356
🎉 CONGRATULATIONS ! 🎉
336357

337-
[<< Day 12](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md) | [Day 14>>](#)
358+
[<< Day 12](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_regular_expressions.md) | [Day 14>>](https://github.com/Asabeneh/30DaysOfJavaScript/blob/master/12_Day/12_day_error_handling.md)

0 commit comments

Comments
 (0)