Avoid confusing prototype methods for static methods
Correct: `Array.from()` (it’s a static method) Incorrect: `Array.join()` (doesn’t exist; it’s a prototype method) This patch uses the common `#` syntax to denote `.prototype.`.
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
|
||||
QuickSort an Array (ascending sort by default).
|
||||
|
||||
Use recursion.
|
||||
Use `Array.filter` and spread operator (`...`) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it.
|
||||
Use recursion.
|
||||
Use `Array.prototype.filter` and spread operator (`...`) to create an array that all elements with values less than the pivot come before the pivot, and all elements with values greater than the pivot come after it.
|
||||
If the parameter `desc` is truthy, return array sorts in descending order.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user