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
+55-2Lines changed: 55 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -682,7 +682,7 @@ Of the three, only `bind()` can be executed after binding. We can create a varia
682
682
683
683
Note that `window.window.window.score` or `window.score` or simply `score` do the same thing. It points to the `score()` function in the global scope.
684
684
685
-
The correct anwser is D. The `score()` and `getAge()` functions are nothing special. The only tricky part is that this.age is incremented each time.
685
+
The correct anwser is D. The `score()` and `getAge()` functions are nothing special. The only tricky part is that `this.age` is incremented each time you call the funtion `getAge()`;
686
686
687
687
</p>
688
688
</details>
@@ -3949,7 +3949,60 @@ The `pipe` function can receive an unlimited number of arguments/parameters than
3949
3949
3950
3950
Please call these functions, which are passed to `pipe`, are child functions. They are then looped and executed one by one with `reduce` method, no matter how many functions you attempt to pass to `pipe`. `v` in the code is simply the argument defined in each child function.
3951
3951
3952
-
So first we have 1, then by executing `plusFour` it becomes 5. When `multiplyBySix` is called, the output turns to 30. It becomes 15 when we call `divideByTwo`. Finally, it becomes 90 as we multiply 15 * 6 when the function `multiplyBySix` is called again.
3952
+
So first we have 1, then by executing `plusFour` it becomes 5. When `multiplyBySix` is called, the output turns to 30. It becomes 15 when we call `divideByTwo`. Finally, it becomes 90 as we multiply 15 \* 6 when the function `multiplyBySix` is called again.
You might see a commonly used algorithm here in the code challenge called "quicksort" in which we apply the strategy "divide and conquer". We also use the "recursive" method when we want to recall the function until it meets our expectations. You might also need to know about the "rest parameter" in JavaScript, as shown by the three dots (...) above.
4000
+
4001
+
The code above helps us to arrange an array in such a way that the value will increase from left to right. Using the quicksort method, we need to create a pivot (likely the first item from right to left or the first item from left to right). First, we divide the original array into two parts: left and right, depending on the value compared to the pivot.
4002
+
4003
+
Next, by calling the function recursively, we keep creating new pivots for the right and left arrays created above for the purpose of sorting value.
4004
+
4005
+
Finally, the original array is sorted from left to right depending on the value.
0 commit comments