Fix snippets typos
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Returns a string with whitespaces compacted.
|
Returns a string with whitespaces compacted.
|
||||||
|
|
||||||
Use `String.prototype.replace()` with a regular expression to replace all occurences of 2 or more whitespace characters with a single space.
|
Use `String.prototype.replace()` with a regular expression to replace all occurrences of 2 or more whitespace characters with a single space.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const compactWhitespace = str => str.replace(/\s{2,}/g, ' ');
|
const compactWhitespace = str => str.replace(/\s{2,}/g, ' ');
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
### detectDeviceType
|
### detectDeviceType
|
||||||
|
|
||||||
Detects wether the website is being opened in a mobile device or a desktop/laptop.
|
Detects weather the website is being opened in a mobile device or a desktop/laptop.
|
||||||
|
|
||||||
Use a regular expression to test the `navigator.userAgent` property to figure out if the device is a mobile device or a desktop/laptop.
|
Use a regular expression to test the `navigator.userAgent` property to figure out if the device is a mobile device or a desktop/laptop.
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Returns all unique values of an array, based on a provided comparator function.
|
Returns all unique values of an array, based on a provided comparator function.
|
||||||
|
|
||||||
Use `Array.prototype.reduce()` and `Array.prototype.some()` for an array containing only the first unique occurence of each value, based on the comparator function, `fn`.
|
Use `Array.prototype.reduce()` and `Array.prototype.some()` for an array containing only the first unique occurrence of each value, based on the comparator function, `fn`.
|
||||||
The comparator function takes two arguments: the values of the two elements being compared.
|
The comparator function takes two arguments: the values of the two elements being compared.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Returns all unique values of an array, based on a provided comparator function.
|
Returns all unique values of an array, based on a provided comparator function.
|
||||||
|
|
||||||
Use `Array.prototype.reduce()` and `Array.prototype.some()` for an array containing only the last unique occurence of each value, based on the comparator function, `fn`.
|
Use `Array.prototype.reduce()` and `Array.prototype.some()` for an array containing only the last unique occurrence of each value, based on the comparator function, `fn`.
|
||||||
The comparator function takes two arguments: the values of the two elements being compared.
|
The comparator function takes two arguments: the values of the two elements being compared.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user