Fix typos
This commit is contained in:
@ -10,7 +10,7 @@ lastUpdated: 2020-10-22T20:24:44+03:00
|
||||
Joins all given URL segments together, then normalizes the resulting URL.
|
||||
|
||||
- Use `String.prototype.join()` to combine URL segments.
|
||||
- Use a series of `String.prototype.replace()` calls with various regexps to normalize the resulting URL (remove double slashes, add proper slashes for protocol, remove slashes before parameters, combine parameters with `'&'` and normalize first parameter delimiter).
|
||||
- Use a series of `String.prototype.replace()` calls with various regular expressions to normalize the resulting URL (remove double slashes, add proper slashes for protocol, remove slashes before parameters, combine parameters with `'&'` and normalize first parameter delimiter).
|
||||
|
||||
```js
|
||||
const URLJoin = (...args) =>
|
||||
|
||||
@ -7,7 +7,7 @@ cover: blog_images/cold-mountains.jpg
|
||||
firstSeen: 2021-08-08T05:00:00-04:00
|
||||
---
|
||||
|
||||
Maps each block of `n` consencutive elements using the given function, `fn`.
|
||||
Maps each block of `n` consecutive elements using the given function, `fn`.
|
||||
|
||||
- Use `Array.prototype.slice()` to get `arr` with `n` elements removed from the left.
|
||||
- Use `Array.prototype.map()` and `Array.prototype.slice()` to apply `fn` to each block of `n` consecutive elements in `arr`.
|
||||
|
||||
@ -14,7 +14,7 @@ Sorts an array of numbers, using the quicksort algorithm.
|
||||
- Use the spread operator (`...`) to clone the original array, `arr`.
|
||||
- If the `length` of the array is less than `2`, return the cloned array.
|
||||
- Use `Math.floor()` to calculate the index of the pivot element.
|
||||
- Use `Array.prototype.reduce()` and `Array.prototype.push()` to split the array into two subarrays. The first one contains elements smaller than or equal to `pivot` and the second on elements greather than it. Destructure the result into two arrays.
|
||||
- Use `Array.prototype.reduce()` and `Array.prototype.push()` to split the array into two subarrays. The first one contains elements smaller than or equal to `pivot` and the second on elements greater than it. Destructure the result into two arrays.
|
||||
- Recursively call `quickSort()` on the created subarrays.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user