@@ -18,19 +18,22 @@ const multiplicationTable = n => {
18
18
console . log ( `${ i } * ${ i } = ${ i * i } ` )
19
19
}
20
20
}
21
+
21
22
multiplicationTable ( 11 )
22
23
console . log ( '----------------------------------------------------------- ' )
23
24
25
+ // 1. 3
24
26
const exponentialTable = ( ) => {
25
27
console . log ( `i\ti^2\t^3` )
26
28
for ( let i = 0 ; i < 11 ; i ++ ) {
27
29
console . log ( `${ i } \t${ i ** 2 } \t${ i ** 3 } ` )
28
30
}
29
31
}
32
+
30
33
exponentialTable ( )
31
34
console . log ( '----------------------------------------------------------- ' )
32
35
33
- // 1. 3
36
+ // 1. 4
34
37
const countries = [
35
38
'ALBANIA' ,
36
39
'BOLIVIA' ,
@@ -81,6 +84,7 @@ const printProductItems = arr => {
81
84
console . log ( `The price of ${ product } is ${ formattedPrice } ` )
82
85
}
83
86
}
87
+
84
88
printProductItems ( products )
85
89
console . log ( '----------------------------------------------------------- ' )
86
90
@@ -94,11 +98,10 @@ const sumOfAllPrices = arr => {
94
98
}
95
99
return total
96
100
}
97
- console . log (
98
- 'the sum of all the prices using for, for of, or forEach ' ,
99
- sumOfAllPrices ( products )
100
- )
101
+
102
+ console . log ( 'the sum of all prices using for of' , sumOfAllPrices ( products ) )
101
103
console . log ( '----------------------------------------------------------- ' )
104
+
102
105
// 2. 3
103
106
const total = products
104
107
. map ( prod => prod . price )
@@ -115,7 +118,6 @@ const totalUsingReduce = products.reduce((accu, curr) => {
115
118
} , 0 )
116
119
117
120
console . log ( 'reduce total' , totalUsingReduce )
118
-
119
121
console . log ( sumOfAllPrices ( products ) )
120
122
console . log ( '==================== END Q2 ============================ ' )
121
123
@@ -157,8 +159,8 @@ const howManyDaysInMonth = () => {
157
159
}
158
160
return statement
159
161
}
160
- console . log ( howManyDaysInMonth ( ) )
161
162
163
+ console . log ( howManyDaysInMonth ( ) )
162
164
console . log ( '----------------------------------------------------------- ' )
163
165
164
166
// 3. 2
@@ -203,14 +205,15 @@ const generate = (type = 'id') => {
203
205
return 'Not a valid format'
204
206
}
205
207
}
208
+
206
209
console . log ( generate ( ) )
207
210
console . log ( generate ( 'id' ) )
208
211
console . log ( generate ( 'hexa' ) )
209
212
console . log ( generate ( 'hexadecimal' ) )
210
213
console . log ( generate ( 'rgb' ) )
211
214
console . log ( generate ( 'RGB' ) )
212
-
213
215
console . log ( generate ( 'rgb' ) )
216
+
214
217
console . log ( '==================== END Q3 ============================ ' )
215
218
216
219
console . log ( '==================== BEGIN Q4 ============================ ' )
@@ -235,7 +238,6 @@ const countries2 = [
235
238
const c = [ 'ESTONIA' , 'FRANCE' , 'GHANA' ]
236
239
countries2 . splice ( 4 , 3 , ...c )
237
240
console . log ( countries2 )
238
-
239
241
console . log ( '----------------------------------------------------------- ' )
240
242
241
243
// 4. 2
@@ -251,7 +253,6 @@ const arrOne = [1, 4, 6, 2, 1]
251
253
console . log ( checkUniqueness ( arrOne ) ) // false
252
254
const arrTwo = [ 1 , 4 , 6 , 2 , 3 ]
253
255
console . log ( checkUniqueness ( arrTwo ) ) // true
254
-
255
256
console . log ( '----------------------------------------------------------- ' )
256
257
257
258
// 4. 3
@@ -284,7 +285,6 @@ console.log(frontEnd, backEnd)
284
285
console . log ( '----------------------------------------------------------- ' )
285
286
286
287
// 5. 2
287
- // const [[h, css, j, r] = f, [n, e, m] = b] = fullStack
288
288
const student = [ 'David' , [ 'HTM' , 'CSS' , 'JS' , 'React' ] , [ 98 , 85 , 90 , 95 ] ]
289
289
const [
290
290
name ,
@@ -303,6 +303,7 @@ console.log(
303
303
reactScore
304
304
)
305
305
console . log ( '----------------------------------------------------------- ' )
306
+
306
307
// 5. 3
307
308
const students = [
308
309
[ 'David' , [ 'HTM' , 'CSS' , 'JS' , 'React' ] , [ 98 , 85 , 90 , 95 ] ] ,
@@ -586,7 +587,6 @@ const numberOfLanguages = async () => {
586
587
'Total number of langauges in the countries API:' ,
587
588
Array . from ( langSet ) . length
588
589
)
589
-
590
590
console . log ( '----------------------------------------------------------- ' )
591
591
}
592
592
numberOfLanguages ( )
@@ -626,7 +626,7 @@ const mostSpokenLanguages = async (n = 10) => {
626
626
627
627
console . log ( 'Most spoken languages' , mostSpokenLanguages ( 15 ) )
628
628
629
- console . log ( '----------------------------------------------------------- ' )
629
+
630
630
// 8.2
631
631
632
632
const add = ( a , b ) => {
0 commit comments