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
Copy file name to clipboardExpand all lines: README.md
+17-1Lines changed: 17 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -96,10 +96,26 @@ Array(6).join('👽')
96
96
# Check how long an operation takes
97
97
```javascript
98
98
//The performance.now() method returns a DOMHighResTimeStamp, measured in milliseconds.
99
-
//performance.now() is relative to page load and more precise in orders of magnitude. Use cases include benchmarking and other cases where a high-resolution time is required such as media (gaming, audio, video, etc.)
99
+
//performance.now() is relative to page load and more precise in orders of magnitude.
100
+
//Use cases include benchmarking and other cases where a high-resolution time is required
101
+
//such as media (gaming, audio, video, //etc.)
100
102
101
103
var startTime =performance.now();
102
104
doSomething();
103
105
constendTime=performance.now();
104
106
console.log("this doSomething took "+ (endTime - startTime) +" milliseconds.");
105
107
```
108
+
109
+
# Two ways to remove an item in a specific in an array
110
+
111
+
```javascript
112
+
//Mutating way
113
+
constmuatatedArray= ['a','b','c','d','e'];
114
+
muatatedArray.splice(2,1)
115
+
console.log(muatatedArray) //['a','b','d','e']
116
+
117
+
//Non-mutating way
118
+
constnonMuatatedArray= ['a','b','c','d','e'];
119
+
constnewArray=nonMuatatedArray.filter((item'index) => !( index === 2 ));
0 commit comments