6
6
|---- | ---------
7
7
| 1 | [ Generate a random number in a given range] ( #How-to-generate-a-random-number-in-a-given-range ) |
8
8
| 2 | [ Find the difference between two arrays] ( #How-to-find-the-difference-between-two-arrays ) |
9
+ | 3 | [ Convert truthy/falsy to boolean(true/false)] ( #Convert_truthy/falsy_to_boolean(true/false) ) |
10
+ | 4 | [ Repeat a string] ( #Repeat_a_string ) |
11
+ | 5 | [ Check how long an operation takes] ( #Check_how_long_an_operation_takes ) |
12
+ | 6 | [ Two ways to remove an item in a specific in an array] ( #Two_ways_to_remove_an_item_in_a_specific_in_an_array ) |
13
+ | 7 | [ Did you know you can flat an array?] ( #Did_you_know_you_can_flat_an_array ) |
14
+ | 8 | [ Get unique values in an array] ( #Get_unique_values_in_an_array ) |
15
+ | 9 | [ Copy Text to Clipboard] ( #Copy_Text_to_Clipboard ) |
16
+ | 10 | [ Nested Destructuring] ( #Nested_Destructuring ) |
17
+
9
18
10
19
11
20
** [ ⬆ Back to Top] ( #table-of-contents ) **
@@ -68,7 +77,8 @@ difference(firstArr, secondArr); //[3,4]
68
77
console .log (' difference' ,difference (firstArr, secondArr))
69
78
```
70
79
71
- # How to convert truthy/falsy to boolean(true/false)
80
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
81
+ ### Convert truthy/falsy to boolean(true/false)
72
82
``` javascript
73
83
const myVar = null ;
74
84
const mySecondVar = 1 ;
@@ -80,8 +90,8 @@ console.log( !!myVar ) // false
80
90
console .log ( Boolean (mySecondVar) ) // true
81
91
console .log ( !! mySecondVar ) // true
82
92
```
83
-
84
- # How to repeat a string
93
+ ** [ ⬆ Back to Top ] ( #table-of-contents ) **
94
+ ### Repeat a string
85
95
``` javascript
86
96
87
97
let aliens = ' ' ;
@@ -99,7 +109,8 @@ Array(6).join('👽')
99
109
// 👽👽👽👽👽👽
100
110
101
111
```
102
- # Check how long an operation takes
112
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
113
+ ### Check how long an operation takes
103
114
``` javascript
104
115
// The performance.now() method returns a DOMHighResTimeStamp, measured in milliseconds.
105
116
// performance.now() is relative to page load and more precise in orders of magnitude.
@@ -112,7 +123,8 @@ const endTime = performance.now();
112
123
console .log (" this doSomething took " + (endTime - startTime) + " milliseconds." );
113
124
```
114
125
115
- # Two ways to remove an item in a specific in an array
126
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
127
+ ### Two ways to remove an item in a specific in an array
116
128
117
129
``` javascript
118
130
// Mutating way
@@ -126,7 +138,8 @@ const newArray = nonMuatatedArray.filter((item, index) => !( index === 2 ));
126
138
console .log (newArray) // ['a','b','d','e']
127
139
```
128
140
129
- # Did you know you can flat an array?
141
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
142
+ ### Did you know you can flat an array
130
143
131
144
``` javascript
132
145
const myArray = [2 , 3 , [4 , 5 ],[7 ,7 , [8 , 9 , [1 , 1 ]]]];
@@ -142,7 +155,8 @@ myArray.flat(infinity) // [2, 3, 4, 5 ,7,7, 8, 9, 1, 1];
142
155
143
156
```
144
157
145
- # Get unique values in an array
158
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
159
+ ### Get unique values in an array
146
160
147
161
``` javascript
148
162
const numbers = [1 ,1 ,3 ,2 ,5 ,3 ,4 ,7 ,7 ,7 ,8 ];
@@ -164,7 +178,9 @@ const unieqNumbers4 = _.uniq(numbers)
164
178
console .log (unieqNumbers4) // [1,3,2,5,4,7,8]
165
179
166
180
```
167
- # Copy Text to Clipboard
181
+
182
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
183
+ ### Copy Text to Clipboard
168
184
169
185
170
186
``` javascript
@@ -182,7 +198,8 @@ function copyToClipboard(){
182
198
183
199
```
184
200
185
- # Nested Destructuring
201
+ ** [ ⬆ Back to Top] ( #table-of-contents ) **
202
+ ### Nested Destructuring
186
203
187
204
188
205
``` javascript
0 commit comments