You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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'.
415
416
416
417
```sh
417
-
['Finland', 'Iceland']
418
+
['Finland','Ireland','Iceland']
418
419
```
419
420
420
421
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'.
Copy file name to clipboardExpand all lines: 07_Day_Functions/07_day_functions.md
+5-2
Original file line number
Diff line number
Diff line change
@@ -502,10 +502,13 @@ console.log('Weight of an object in Newton: ', weightOfObject(100, 1.62)) // gra
502
502
503
503
### Function declaration versus Arrow function
504
504
505
-
It ill be covered in other time
505
+
It Will be covered in other section.
506
506
507
507
🌕 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.
508
508
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
+
509
512
## 💻 Exercises
510
513
511
514
### Exercises: Level 1
@@ -617,7 +620,7 @@ It ill be covered in other time
617
620
618
621
### Exercises: Level 3
619
622
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.
Copy file name to clipboardExpand all lines: 08_Day_Objects/08_day_objects.md
+8-6
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ Variables scopes can be:
52
52
Variable can be declared globally or locally or window scope. We will see both global and local scope.
53
53
Anything declared without let, var or const is scoped at window level.
54
54
55
-
Let us image we have a scope.js file.
55
+
Let us imagine that we have a scope.js file.
56
56
57
57
### Window Scope
58
58
@@ -102,23 +102,25 @@ let a = 'JavaScript' // is a global scope it will be found anywhere in this file
102
102
let b =10// is a global scope it will be found anywhere in this file
103
103
functionletsLearnScope() {
104
104
console.log(a, b) // JavaScript 10, accessible
105
-
letc=30
105
+
letvalue=false
106
106
if (true) {
107
107
// we can access from the function and outside the function but
108
108
// variables declared inside the if will not be accessed outside the if block
109
109
let a ='Python'
110
110
let b =20
111
+
let c =30
111
112
let d =40
113
+
value =!value
112
114
console.log(a, b, c) // Python 20 30
113
115
}
114
116
// 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
116
118
}
117
119
letsLearnScope()
118
120
console.log(a, b) // JavaScript 10, accessible
119
121
```
120
122
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 ({}).
122
124
123
125
```js
124
126
//scope.js
@@ -163,7 +165,7 @@ if (true){
163
165
for(let i =0; i <3; i++){
164
166
console.log(i) // 1, 2, 3
165
167
}
166
-
// console.log(i), Uncaught ReferenceError: gravity is not defined
168
+
// console.log(i), Uncaught ReferenceError: i is not defined
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.
134
133
135
134
- setInterval
136
135
- setTimeout
137
136
138
-
#### setInterval
137
+
#### Setting Interaval using a setInterval function
139
138
140
139
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.
setInterval(sayHello, 2000) // it prints hello in every 2 seconds
153
+
setInterval(sayHello, 1000) // it prints hello in every second, 1000ms is 1s
155
154
```
156
155
157
-
#### setTimeout
156
+
#### Setting a time using a setTimeout
158
157
159
158
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.
const areAllStr = names.some((name) => typeof name === 'number')
485
+
const areAllStr = names.some((name) => typeof name === 'number') // Are all strings ?
493
486
console.log(areAllStr) // false
494
487
```
495
488
@@ -556,7 +549,7 @@ users.sort((a, b) => {
556
549
return 0
557
550
})
558
551
console.log(users) // sorted ascending
559
-
//[{…}, {…}, {…}, {…}]
552
+
//[{…}, {…}, {…}, {…}]
560
553
```
561
554
562
555
🌕 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.
Copy file name to clipboardExpand all lines: 17_Day_Web_storages/17_day_web_storages.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,7 @@
38
38
39
39
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.
40
40
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:
0 commit comments