Skip to content

Commit faace4f

Browse files
committed
typo fixes and some minor corrections
1 parent 0f4a2b6 commit faace4f

File tree

10 files changed

+106
-101
lines changed

10 files changed

+106
-101
lines changed

05_Day_Arrays/05_day_arrays.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ An array is a collection of different data types which are ordered and changeabl
5959
### How to create an empty array
6060

6161
In JavaScript, we can create an array in different ways. Let us see different ways to create an array.
62-
It is very common to use *const* instead of *let* to declare an array variable. If you ar using const it means you do not use that variable name again.
62+
It is very common to use _const_ instead of _let_ to declare an array variable. If you ar using const it means you do not use that variable name again.
6363

6464
- Using Array constructor
6565

@@ -400,7 +400,7 @@ if(index === -1){
400400
// we can use also ternary here
401401
index === -1 ? console.log('This fruit does not exist in the array'): console.log('This fruit does exist in the array')
402402

403-
// let us check if a avocado exist in the array
403+
// let us check if an avocado exist in the array
404404
let indexOfAvocado = fruits.indexOf('avocado') // -1, if the element not found index is -1
405405
if(indexOfAvocado === -1){
406406
console.log('This fruit does not exist in the array')
@@ -521,18 +521,20 @@ Splice: It takes three parameters:Starting position, number of times to be remov
521521

522522
```js
523523
const numbers = [1, 2, 3, 4, 5]
524-
525-
console.log(numbers.splice()) // -> remove all items
524+
numbers.splice()
525+
console.log(numbers) // -> remove all items
526526

527527
```
528528

529529
```js
530530
const numbers = [1, 2, 3, 4, 5]
531-
console.log(numbers.splice(0,1)) // remove the first item
531+
numbers.splice(0,1)
532+
console.log(numbers) // remove the first item
532533
```
533534

534535
```js
535-
const numbers = [1, 2, 3, 4, 5, 6];
536+
const numbers = [1, 2, 3, 4, 5, 6]
537+
numbers.splice(3, 3, 7, 8, 9)
536538
console.log(numbers.splice(3, 3, 7, 8, 9)) // -> [1, 2, 3, 7, 8, 9] //it removes three item and replace three items
537539
```
538540

@@ -544,15 +546,13 @@ Push: adding item in the end. To add item to the end of an existing array we use
544546
// syntax
545547
const arr = ['item1', 'item2','item3']
546548
arr.push('new item')
547-
548549
console.log(arr)
549550
// ['item1', 'item2','item3','new item']
550551
```
551552

552553
```js
553554
const numbers = [1, 2, 3, 4, 5]
554555
numbers.push(6)
555-
556556
console.log(numbers) // -> [1,2,3,4,5,6]
557557

558558
numbers.pop() // -> remove one item from the end
@@ -562,7 +562,6 @@ console.log(numbers) // -> [1,2,3,4,5]
562562
```js
563563
let fruits = ['banana', 'orange', 'mango', 'lemon']
564564
fruits.push('apple')
565-
566565
console.log(fruits) // ['banana', 'orange', 'mango', 'lemon', 'apple']
567566

568567
fruits.push('lime')
@@ -576,7 +575,6 @@ pop: Removing item in the end.
576575
```js
577576
const numbers = [1, 2, 3, 4, 5]
578577
numbers.pop() // -> remove one item from the end
579-
580578
console.log(numbers) // -> [1,2,3,4]
581579
```
582580

@@ -587,7 +585,6 @@ shift: Removing one array element in the beginning of the array.
587585
```js
588586
const numbers = [1, 2, 3, 4, 5]
589587
numbers.shift() // -> remove one item from the beginning
590-
591588
console.log(numbers) // -> [2,3,4,5]
592589
```
593590

@@ -598,7 +595,6 @@ unshift: Adding array element in the beginning of the array.
598595
```js
599596
const numbers = [1, 2, 3, 4, 5]
600597
numbers.unshift(0) // -> add one item from the beginning
601-
602598
console.log(numbers) // -> [0,1,2,3,4,5]
603599
```
604600

@@ -609,7 +605,6 @@ reverse: reverse the order of an array.
609605
```js
610606
const numbers = [1, 2, 3, 4, 5]
611607
numbers.reverse() // -> reverse array order
612-
613608
console.log(numbers) // [5, 4, 3, 2, 1]
614609

615610
numbers.reverse()
@@ -769,7 +764,7 @@ const webTechs = [
769764
- Find the median age(one middle item or two middle items divided by two)
770765
- Find the average age(all items divided by number of items)
771766
- Find the range of the ages(max minus min)
772-
- Compare the value of (min - average) and (max - average), use *abs()* method
767+
- Compare the value of (min - average) and (max - average), use _abs()_ method
773768
1.Slice the first ten countries from the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
774769
1. Find the middle country(ies) in the [countries array](https://github.com/Asabeneh/30DaysOfJavaScript/tree/master/data/countries.js)
775770
2. Divide the countries array into two equal arrays if it is even. If countries array is not even , one more country for the first half.

07_Day_Functions/07_day_functions.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ const sumAllNums = (...args) => {
273273
console.log(args)
274274
}
275275

276-
sumAllNums(1, 2, 3, 4))
276+
sumAllNums(1, 2, 3, 4)
277277
// [1, 2, 3, 4]
278278

279279
```

08_Day_Objects/08_day_objects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ _Object.keys_: To get the keys or properties of an object as an array
391391

392392
```js
393393
const keys = Object.keys(copyPerson)
394-
console.log(keys) //['name', 'age', 'country', 'skills', 'address', 'getPersonInfo']
394+
console.log(keys) //['firstName', 'age', 'country','city', 'skills','title', 'address', 'getPersonInfo']
395395
const address = Object.keys(copyPerson.address)
396396
console.log(address) //['street', 'pobox', 'city']
397397
```

09_Day_Higher_order_functions/09_day_higher_order_functions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ console.log(higherOrder(2)(3)(10))
8888
Let us see were we use call back functions. For instance the _forEach_ method uses call back.
8989

9090
```js
91-
const numbers = [1, 2, 3, 4]
91+
const numbers = [1, 2, 3, 4, 5]
9292
const sumArray = arr => {
9393
let sum = 0
9494
const callback = function(element) {
@@ -518,7 +518,7 @@ console.log(numbers) //[100, 37, 9.81, 3.14]
518518
519519
#### Sorting Object Arrays
520520
521-
When ever we sort objects in an array. We use the object key to compare. Lets see the example below.
521+
Whenever we sort objects in an array, we use the object key to compare. Let us see the example below.
522522
523523
```js
524524
objArr.sort(function (a, b) {
@@ -538,7 +538,7 @@ objArr.sort(function (a, b) {
538538
const users = [
539539
{ name: 'Asabeneh', age: 150 },
540540
{ name: 'Brook', age: 50 },
541-
{ name: 'Eyo', age: 100 },
541+
{ name: 'Eyob', age: 100 },
542542
{ name: 'Elias', age: 22 },
543543
]
544544
users.sort((a, b) => {

10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md

+6-11
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
## Set
4646

4747
Set is a collection of elements. Set can only contains unique elements.
48-
Lets see how to create a set
48+
Let us see how to create a set in the section below.
4949

5050
### Creating an empty set
5151

@@ -55,7 +55,7 @@ console.log(companies)
5555
```
5656

5757
```sh
58-
{}
58+
Set(0) {}
5959
```
6060

6161
### Creating set from array
@@ -117,7 +117,6 @@ companies.add('Facebook')
117117
companies.add('Amazon')
118118
companies.add('Oracle')
119119
companies.add('Microsoft')
120-
121120
console.log(companies.size) // 5 elements in the set
122121
console.log(companies)
123122
```
@@ -165,13 +164,11 @@ It removes all the elements from a set.
165164

166165
```js
167166
companies.clear()
168-
169167
console.log(companies)
170168
```
171169

172170
```sh
173-
{}
174-
171+
Set(0) {}
175172
```
176173

177174
See the example below to learn how to use set.
@@ -202,7 +199,7 @@ console.log(counts)
202199
```
203200

204201
```js
205-
;[
202+
[
206203
{ lang: 'English', count: 3 },
207204
{ lang: 'Finnish', count: 1 },
208205
{ lang: 'French', count: 2 },
@@ -345,7 +342,7 @@ Helsinki
345342

346343
### Checking key in Map
347344

348-
Check if a key exist in a map using _has_ method. It returns _true_ or _false_.
345+
Check if a key exists in a map using _has_ method. It returns _true_ or _false_.
349346

350347
```js
351348
console.log(countriesMap.has('Finland'))
@@ -371,7 +368,7 @@ for (const country of countriesMap) {
371368

372369
```js
373370
for (const [country, city] of countriesMap){
374-
console.log(country, city)
371+
console.log(country, city)
375372
}
376373
```
377374

@@ -438,8 +435,6 @@ const countries = ['Finland', 'Sweden', 'Norway']
438435
]
439436
```
440437

441-
442438
🎉 CONGRATULATIONS ! 🎉
443439

444-
445440
[<< Day 9](../09_Day_Higher_order_functions/09_day_higher_order_functions.md) | [Day 11 >>](../11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md)

11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md

+30-30
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@
1818
![Day 11](../images/banners/day_1_11.png)
1919

2020
- [Day 11](#day-11)
21-
- [Destructuring and Spread](#destructuring-and-spread)
22-
- [Destructing Arrays](#destructing-arrays)
23-
- [Destructuring during iteration](#destructuring-during-iteration)
24-
- [Destructuring Object](#destructuring-object)
25-
- [Renaming during structuring](#renaming-during-structuring)
26-
- [Object parameter without destructuring](#object-parameter-without-destructuring)
27-
- [Object parameter with destructuring](#object-parameter-with-destructuring)
28-
- [Destructuring object during iteration](#destructuring-object-during-iteration)
29-
- [Spread or Rest Operator](#spread-or-rest-operator)
30-
- [Spread operator to get the rest of array elements](#spread-operator-to-get-the-rest-of-array-elements)
31-
- [Spread operator to copy array](#spread-operator-to-copy-array)
32-
- [Spread operator to copy object](#spread-operator-to-copy-object)
33-
- [Spread operator with arrow function](#spread-operator-with-arrow-function)
34-
- [Exercises](#exercises)
35-
- [Exercises: Level 1](#exercises-level-1)
36-
- [Exercises: Level 2](#exercises-level-2)
37-
- [Exercises: Level 3](#exercises-level-3)
21+
- [Destructuring and Spread](#destructuring-and-spread)
22+
- [Destructing Arrays](#destructing-arrays)
23+
- [Destructuring during iteration](#destructuring-during-iteration)
24+
- [Destructuring Object](#destructuring-object)
25+
- [Renaming during structuring](#renaming-during-structuring)
26+
- [Object parameter without destructuring](#object-parameter-without-destructuring)
27+
- [Object parameter with destructuring](#object-parameter-with-destructuring)
28+
- [Destructuring object during iteration](#destructuring-object-during-iteration)
29+
- [Spread or Rest Operator](#spread-or-rest-operator)
30+
- [Spread operator to get the rest of array elements](#spread-operator-to-get-the-rest-of-array-elements)
31+
- [Spread operator to copy array](#spread-operator-to-copy-array)
32+
- [Spread operator to copy object](#spread-operator-to-copy-object)
33+
- [Spread operator with arrow function](#spread-operator-with-arrow-function)
34+
- [Exercises](#exercises)
35+
- [Exercises: Level 1](#exercises-level-1)
36+
- [Exercises: Level 2](#exercises-level-2)
37+
- [Exercises: Level 3](#exercises-level-3)
3838

3939
# Day 11
4040

@@ -108,7 +108,7 @@ If we like to skip on of the values in the array we use additional comma. The co
108108

109109
```js
110110
const names = ['Asabeneh', 'Brook', 'David', 'John']
111-
let [, secondPerson, , fourthPerson] = name // first and third person is omitted
111+
let [, secondPerson, , fourthPerson] = names // first and third person is omitted
112112

113113
console.log(secondPerson, fourthPerson)
114114
```
@@ -218,7 +218,7 @@ console.log(w, h, a, p)
218218
20 10 200 undefined
219219
```
220220

221-
If the key is not found in the object the variable will be assigned to undefined. In case, the key is not in the object we can give a default value during declaration. See the example.
221+
If the key is not found in the object the variable will be assigned to undefined. Sometimes the key might not be in the object, in that case we can give a default value during declaration. See the example.
222222

223223
```js
224224
const rectangle = {
@@ -229,7 +229,7 @@ const rectangle = {
229229
let { width, height, area, perimeter = 60 } = rectangle
230230

231231
console.log(width, height, area, perimeter) //20 10 200 60
232-
//Lets modify the object:width to 30 and perimeter to 80
232+
//Let us modify the object:width to 30 and perimeter to 80
233233
```
234234

235235
```js
@@ -243,7 +243,7 @@ let { width, height, area, perimeter = 60 } = rectangle
243243
console.log(width, height, area, perimeter) //30 10 200 80
244244
```
245245

246-
Destructuring keys as a function parameters. Lets create a function which take a rectangle object and it return a perimeter of a rectangle.
246+
Destructuring keys as a function parameters. Let us create a function which takes a rectangle object and it returns a perimeter of a rectangle.
247247

248248
### Object parameter without destructuring
249249

@@ -282,7 +282,7 @@ const person = {
282282
],
283283
languages: ['Amharic', 'English', 'Suomi(Finnish)']
284284
}
285-
// Lets create a function which give information about the person object without destructuring
285+
// Let us create a function which give information about the person object without destructuring
286286

287287
const getPersonInfo = obj => {
288288
const skills = obj.skills
@@ -314,7 +314,7 @@ console.log(calculatePerimeter(rect)) // 60
314314
```
315315

316316
```js
317-
// Lets create a function which give information about the person object with destructuring
317+
// Let us create a function which give information about the person object with destructuring
318318
const getPersonInfo = ({
319319
firstName,
320320
lastName,
@@ -335,7 +335,7 @@ const getPersonInfo = ({
335335
}
336336
console.log(getPersonInfo(person))
337337
/*
338-
Asabeneh Yetayeh lives in Finland. He is 200 years old. He is an Instructor and Developer. He teaches HTML, CSS, JavaScript, React, Redux, Node, MongoDB, Python and D3.js. He speaks Amharic, English and a little bit of Suomi(Finnish)
338+
Asabeneh Yetayeh lives in Finland. He is 250 years old. He is an Instructor and Developer. He teaches HTML, CSS, JavaScript, React, Redux, Node, MongoDB, Python and D3.js. He speaks Amharic, English and a little bit of Suomi(Finnish)
339339
*/
340340
```
341341

@@ -373,7 +373,7 @@ Assess Test Result 4/1/2020 1:00 false
373373

374374
### Spread or Rest Operator
375375

376-
When we destructure an array we use the spread operator(...) to get the rest elements as array. In addition to that we use spread operator to spread arr elements to another array.
376+
When we destructure an array we use the spread operator(...) to get the rest elements as array. In addition to that we use spread operator to spread array elements to another array.
377377

378378
### Spread operator to get the rest of array elements
379379

@@ -499,7 +499,7 @@ const sumAllNums = (...args) => {
499499
console.log(args)
500500
}
501501

502-
sumAllNums(1, 2, 3,4,5)
502+
sumAllNums(1, 2, 3, 4, 5)
503503

504504
```
505505

@@ -519,7 +519,7 @@ const sumAllNums = (...args) => {
519519

520520
}
521521

522-
console.log(sumAllNums(1, 2, 3,4,5))
522+
console.log(sumAllNums(1, 2, 3, 4, 5))
523523
```
524524

525525
```sh
@@ -597,7 +597,6 @@ const users = [
597597
1. Iterate through the users array and get all the keys of the object using destructuring
598598
2. Find the persons who have less than two skills
599599

600-
601600
### Exercises: Level 3
602601

603602
1. Destructure the countries object print name, capital, population and languages of all countries
@@ -613,7 +612,7 @@ const users = [
613612
```
614613

615614
3. Write a function called *convertArrayToObject* which can convert the array to a structure object.
616-
615+
617616
```js
618617
const students = [
619618
['David', ['HTM', 'CSS', 'JS', 'React'], [98, 85, 90, 95]],
@@ -693,6 +692,7 @@ const users = [
693692
}
694693

695694
```
695+
696696
🎉 CONGRATULATIONS ! 🎉
697697

698-
[<< Day 10](../10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md) | [Day 12 >>](../12_Day_Regular_expressions/12_day_regular_expressions.md)
698+
[<< Day 10](../10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md) | [Day 12 >>](../12_Day_Regular_expressions/12_day_regular_expressions.md)

0 commit comments

Comments
 (0)