Skip to content

Commit 97f84bf

Browse files
committed
corrections
1 parent b094b3f commit 97f84bf

File tree

12 files changed

+100
-97
lines changed

12 files changed

+100
-97
lines changed

03_Day_Booleans_operators_date/03_booleans_operators_date.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ We agreed that boolean values are either true or false.
7373
### Truthy values
7474

7575
- All numbers(positive and negative) are truthy except zero
76-
- All strings are truthy
76+
- All strings are truthy except an empty string ('')
7777
- The boolean true
7878

7979
### Falsy values
@@ -616,7 +616,7 @@ console.log(`${date}/${month}/${year} ${hours}:${minutes}`) // 4/1/2020 0:56
616616
1. Write a script that prompt the user to enter number of years. Calculate the number of seconds a person can live. Assume some one lives just hundred years
617617

618618
```sh
619-
Enter number of yours you live: 100
619+
Enter number of years you live: 100
620620
You lived 3153600000 seconds.
621621
```
622622

06_Day_Loops/06_day_loops.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const numbers = [1, 2, 3, 4, 5]
108108
const newArr = []
109109
let sum = 0
110110
for(let i = 0; i < numbers.length; i++){
111-
newArr.push(i * i)
111+
newArr.push( numbers[i] ** 2)
112112

113113
}
114114

@@ -406,6 +406,7 @@ for(let i = 0; i <= 5; i++){
406406
['Germany', 'GER', 7],
407407
['Hungary', 'HUN', 7],
408408
['Ireland', 'IRE', 7],
409+
['Iceland', 'ICE', 7],
409410
['Japan', 'JAP', 5],
410411
['Kenya', 'KEN', 5]
411412
]
@@ -414,7 +415,7 @@ for(let i = 0; i <= 5; i++){
414415
2. In above countries array, check if there is a country or countries containing the word 'land'. If there are countries containing 'land', print it as array. If there is no country containing the word 'land', print 'All these countries are without land'.
415416
416417
```sh
417-
['Finland', 'Iceland']
418+
['Finland','Ireland', 'Iceland']
418419
```
419420
420421
3. In above countries array, check if there is a country or countries end with a substring 'ia'. If there are countries end with, print it as array. If there is no country containing the word 'ai', print 'These are countries ends without ia'.

07_Day_Functions/07_day_functions.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,13 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra
502502

503503
### Function declaration versus Arrow function
504504

505-
It ill be covered in other time
505+
It Will be covered in other section.
506506

507507
🌕 You are a rising star, now you knew function . Now, you are super charged with the power of functions. You have just completed day 7 challenges and you are 7 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.
508508

509+
## Testimony
510+
Now it is time to express your thoughts about the Author and 30DaysOfJavaScript. You can leave your testimonial on this [link](https://testimonify.herokuapp.com/)
511+
509512
## 💻 Exercises
510513

511514
### Exercises: Level 1
@@ -617,7 +620,7 @@ It ill be covered in other time
617620

618621
### Exercises: Level 3
619622

620-
1. Modify question number n . Declare a function name _userIdGeneratedByUser_. It doesn’t take any parameter but it takes two inputs using prompt(). One of the input is the number of characters and the second input is the number of ids which are supposed to be generated.
623+
1. Modify the _userIdGenerator_ function. Declare a function name _userIdGeneratedByUser_. It doesn’t take any parameter but it takes two inputs using prompt(). One of the input is the number of characters and the second input is the number of ids which are supposed to be generated.
621624

622625
```sh
623626
userIdGeneratedByUser()

08_Day_Objects/08_day_objects.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Variables scopes can be:
5252
Variable can be declared globally or locally or window scope. We will see both global and local scope.
5353
Anything declared without let, var or const is scoped at window level.
5454

55-
Let us image we have a scope.js file.
55+
Let us imagine that we have a scope.js file.
5656

5757
### Window Scope
5858

@@ -102,23 +102,25 @@ let a = 'JavaScript' // is a global scope it will be found anywhere in this file
102102
let b = 10 // is a global scope it will be found anywhere in this file
103103
function letsLearnScope() {
104104
console.log(a, b) // JavaScript 10, accessible
105-
let c = 30
105+
let value = false
106106
if (true) {
107107
// we can access from the function and outside the function but
108108
// variables declared inside the if will not be accessed outside the if block
109109
let a = 'Python'
110110
let b = 20
111+
let c = 30
111112
let d = 40
113+
value = !value
112114
console.log(a, b, c) // Python 20 30
113115
}
114116
// we can not access c because c's scope is only the if block
115-
console.log(a, b) // JavaScript 10
117+
console.log(a, b, value) // JavaScript 10 true
116118
}
117119
letsLearnScope()
118120
console.log(a, b) // JavaScript 10, accessible
119121
```
120122

121-
Now, you have an understanding of scope. A variable declared with *var* only scoped to function but variable declared with *let* or *const* is block scope(function block, if block, loop etc). Block in JavaScript is a code in between two curly brackets ({}).
123+
Now, you have an understanding of scope. A variable declared with *var* only scoped to function but variable declared with *let* or *const* is block scope(function block, if block, loop block, etc). Block in JavaScript is a code in between two curly brackets ({}).
122124

123125
```js
124126
//scope.js
@@ -163,7 +165,7 @@ if (true){
163165
for(let i = 0; i < 3; i++){
164166
console.log(i) // 1, 2, 3
165167
}
166-
// console.log(i), Uncaught ReferenceError: gravity is not defined
168+
// console.log(i), Uncaught ReferenceError: i is not defined
167169

168170
```
169171

@@ -432,7 +434,7 @@ console.log(copyPerson.hasOwnProperty('score'))
432434
### Exercises: Level 2
433435

434436
1. Find the person who has many skills in the users object.
435-
1. Count logged in users,count users having greater than equal to 50 points from the following object.
437+
1. Count logged in users, count users having greater than equal to 50 points from the following object.
436438

437439
````js
438440
const users = {

09_Day_Higher_order_functions/09_day_higher_order_functions.md

+23-30
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,22 @@ const higherOrder = n => {
8181
}
8282
return doWhatEver
8383
}
84-
8584
return doSomething
8685
}
8786
console.log(higherOrder(2)(3)(10))
8887
```
8988

90-
Let us see were we use call back functions.For instance the _forEach_ method uses call back.
89+
Let us see were we use call back functions. For instance the _forEach_ method uses call back.
9190

9291
```js
9392
const numbers = [1, 2, 3, 4]
9493
9594
const sumArray = arr => {
9695
let sum = 0
97-
const callBack = function(element) {
96+
const callback = function(element) {
9897
sum += element
9998
}
100-
numbers.forEach(callback)
99+
arr.forEach(callback)
101100
return sum
102101

103102
}
@@ -115,7 +114,7 @@ const numbers = [1, 2, 3, 4]
115114
116115
const sumArray = arr => {
117116
let sum = 0
118-
numbers.forEach(function(element) {
117+
arr.forEach(function(element) {
119118
sum += element
120119
})
121120
return sum
@@ -128,20 +127,20 @@ console.log(sumArray(numbers))
128127
15
129128
```
130129

131-
### setting time
130+
### Setting time
132131

133-
In JavaScript we can execute some activity on certain interval of time or we can schedule(wait) for sometime to execute some activities.
132+
In JavaScript we can execute some activities in a certain interval of time or we can schedule(wait) for some time to execute some activities.
134133

135134
- setInterval
136135
- setTimeout
137136

138-
#### setInterval
137+
#### Setting Interaval using a setInterval function
139138

140139
In JavaScript, we use setInterval higher order function to do some activity continuously with in some interval of time. The setInterval global method take a callback function and a duration as a parameter. The duration is in milliseconds and the callback will be always called in that interval of time.
141140

142141
```js
143142
// syntax
144-
function callBack() {
143+
function callback() {
145144
// code goes here
146145
}
147146
setInterval(callback, duration)
@@ -151,10 +150,10 @@ setInterval(callback, duration)
151150
function sayHello() {
152151
console.log('Hello')
153152
}
154-
setInterval(sayHello, 2000) // it prints hello in every 2 seconds
153+
setInterval(sayHello, 1000) // it prints hello in every second, 1000ms is 1s
155154
```
156155

157-
#### setTimeout
156+
#### Setting a time using a setTimeout
158157

159158
In JavaScript, we use setTimeout higher order function to execute some action at some time in the future. The setTimeout global method take a callback function and a duration as a parameter. The duration is in milliseconds and the callback wait for that amount of time.
160159

@@ -195,9 +194,8 @@ arr.forEach((element, index, arr) => console.log(index, element, arr))
195194

196195
```js
197196
let sum = 0;
198-
const numbers = [1,2,3,4,5];
199-
numbers.forEach(num => console.log(num)))
200-
197+
const numbers = [1, 2, 3, 4, 5];
198+
numbers.forEach(num => console.log(num))
201199
console.log(sum)
202200
```
203201

@@ -211,8 +209,8 @@ console.log(sum)
211209

212210
```js
213211
let sum = 0;
214-
const numbers = [1,2,3,4,5];
215-
numbers.forEach(num => sum += num))
212+
const numbers = [1, 2, 3, 4, 5];
213+
numbers.forEach(num => sum += num)
216214

217215
console.log(sum)
218216
```
@@ -349,6 +347,7 @@ console.log(countriesHaveFiveLetters)
349347
```js
350348
const scores = [
351349
{ name: 'Asabeneh', score: 95 },
350+
{ name: 'Lidiya', score: 98 },
352351
{ name: 'Mathias', score: 80 },
353352
{ name: 'Elias', score: 50 },
354353
{ name: 'Martha', score: 85 },
@@ -360,7 +359,7 @@ console.log(scoresGreaterEight)
360359
```
361360

362361
```sh
363-
[{name: 'Asabeneh', score: 95}, {name: 'Martha', score: 85},{name: 'John', score: 100}]
362+
[{name: 'Asabeneh', score: 95}, { name: 'Lidiya', score: 98 },{name: 'Martha', score: 85},{name: 'John', score: 100}]
364363
```
365364
366365
### reduce
@@ -391,7 +390,7 @@ _every_: Check if all the elements are similar in one aspect. It returns boolean
391390
392391
```js
393392
const names = ['Asabeneh', 'Mathias', 'Elias', 'Brook']
394-
const areAllStr = names.every((name) => typeof name === 'string')
393+
const areAllStr = names.every((name) => typeof name === 'string') // Are all strings?
395394
396395
console.log(arrAllStr)
397396
```
@@ -402,11 +401,9 @@ true
402401
403402
```js
404403
const bools = [true, true, true, true]
405-
const areAllTrue = bools.every((b) => {
406-
return b === true
407-
})
404+
const areAllTrue = bools.every((b) => b === true) // Are all true?
408405
409-
console.log(areAllTrue) //true
406+
console.log(areAllTrue) // true
410407
```
411408
412409
```sh
@@ -448,9 +445,7 @@ const scores = [
448445
{ name: 'John', score: 100 },
449446
]
450447
451-
const score = scores.find((user) => {
452-
return user.score > 80
453-
})
448+
const score = scores.find((user) => user.score > 80)
454449
console.log(score)
455450
```
456451
@@ -481,15 +476,13 @@ _some_: Check if some of the elements are similar in one aspect. It returns bool
481476
const names = ['Asabeneh', 'Mathias', 'Elias', 'Brook']
482477
const bools = [true, true, true, true]
483478
484-
const areSomeTrue = bools.some((b) => {
485-
return b === true
486-
})
479+
const areSomeTrue = bools.some((b) => b === true)
487480
488481
console.log(areSomeTrue) //true
489482
```
490483
491484
```js
492-
const areAllStr = names.some((name) => typeof name === 'number')
485+
const areAllStr = names.some((name) => typeof name === 'number') // Are all strings ?
493486
console.log(areAllStr) // false
494487
```
495488
@@ -556,7 +549,7 @@ users.sort((a, b) => {
556549
return 0
557550
})
558551
console.log(users) // sorted ascending
559-
//[{…}, {…}, {…}, {…}]
552+
// [{…}, {…}, {…}, {…}]
560553
```
561554
562555
🌕 You are doing great.Never give up because great things take time. You have just completed day 9 challenges and you are 9 steps a head in to your way to greatness. Now do some exercises for your brain and for your muscle.

10_Day_Sets_and_Maps/10_day_Sets_and_Maps.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Set(6) {1, 2, 3, 4, 5,6}
245245

246246
### Intersection of sets
247247

248-
To find an intersection of two sets can be achieved using filter. Lets find the union of set A and set B (A ∩ B)
248+
To find an intersection of two sets can be achieved using filter. Lets find the intersection of set A and set B (A ∩ B)
249249

250250
```js
251251
let a = [1, 2, 3, 4, 5]
@@ -388,8 +388,8 @@ Norway Oslo
388388
### Exercises:Level 1
389389

390390
```js
391-
const a = {4, 5, 8, 9}
392-
const b = {3, 4, 5, 7}
391+
const a = [4, 5, 8, 9]
392+
const b = [3, 4, 5, 7]
393393
const countries = ['Finland', 'Sweden', 'Norway']
394394
```
395395

@@ -432,9 +432,9 @@ const countries = ['Finland', 'Sweden', 'Norway']
432432
// Your output should look like this
433433
console.log(mostSpokenLanguages(countries, 3))
434434
[
435-
{'English':91},
436-
{'French':45},
437-
{'Arabic':25}
435+
{English:91},
436+
{French:45},
437+
{Arabic:25}
438438
]
439439
```
440440

11_Day_Destructuring_and_spreading/11_day_destructuring_and_spreading.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ const rectangle = {
209209
height: 10,
210210
area: 200
211211
}
212-
let { width: w, heigh: h, area: a, perimeter: p } = rectangle
212+
let { width: w, height: h, area: a, perimeter: p } = rectangle
213213

214214
console.log(w, h, a, p)
215215
```
@@ -226,7 +226,7 @@ const rectangle = {
226226
height: 10,
227227
area: 200
228228
}
229-
let { width, heigh, area, perimeter = 60 } = rectangle
229+
let { width, height, area, perimeter = 60 } = rectangle
230230

231231
console.log(width, height, area, perimeter) //20 10 200 60
232232
//Lets modify the object:width to 30 and perimeter to 80
@@ -239,8 +239,8 @@ const rectangle = {
239239
area: 200,
240240
perimeter: 80
241241
}
242-
let { width, heigh, area, perimeter = 60 } = rectangle
243-
console.log(width, height, area, perimeter) //20 10 200 80
242+
let { width, height, area, perimeter = 60 } = rectangle
243+
console.log(width, height, area, perimeter) //30 10 200 80
244244
```
245245

246246
Destructuring keys as a function parameters. Lets create a function which take a rectangle object and it return a perimeter of a rectangle.
@@ -695,4 +695,4 @@ const users = [
695695
```
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)

17_Day_Web_storages/17_day_web_storages.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
Web Storage(sessionStorage and localStorage) is a new HTML5 API offering important benefits over traditional cookies. Before HTML5, application data had to be stored in cookies, included in every server request. Web storage is more secure, and large amounts of data can be stored locally, without affecting website performance. The data storage limit of cookies in many web browsers is about 4 KB per cookie. We Storages can store far larger data (at least 5MB) and never transferred to the server. All sites from the same or one origin can store and access the same data.
4040

41-
The data being stored can be accessed using JavaScript, which gives you the ability to leverage client-side scripting to do many things that have traditionally involved server-side programming and relational databases. The are are two Web Storage objects:
41+
The data being stored can be accessed using JavaScript, which gives you the ability to leverage client-side scripting to do many things that have traditionally involved server-side programming and relational databases. There are two Web Storage objects:
4242

4343
- sessionStorage
4444
- localStorage

0 commit comments

Comments
 (0)