Fix typos and missing highlighting
This commit is contained in:
@ -99,8 +99,8 @@ const capitalize = (str, lowerRest = false) =>
|
|||||||
Convert string `toLowerCase()` and use `replace()` to remove non-alphanumeric characters from it.
|
Convert string `toLowerCase()` and use `replace()` to remove non-alphanumeric characters from it.
|
||||||
Then, `split('')` into individual characters, `reverse()`, `join('')` and compare to the original, unreversed string, after converting it `tolowerCase()`.
|
Then, `split('')` into individual characters, `reverse()`, `join('')` and compare to the original, unreversed string, after converting it `tolowerCase()`.
|
||||||
|
|
||||||
```
|
```js
|
||||||
palindrome = str => (str.toLowerCase().replace(/[\W_]/g,'').split('').reverse().join('')==str.toLowerCase().replace(/[\W_]/g,''));
|
const palindrome = str => (str.toLowerCase().replace(/[\W_]/g,'').split('').reverse().join('')==str.toLowerCase().replace(/[\W_]/g,''));
|
||||||
```
|
```
|
||||||
|
|
||||||
### Count occurrences of a value in array
|
### Count occurrences of a value in array
|
||||||
|
|||||||
@ -3,6 +3,6 @@
|
|||||||
Convert string `toLowerCase()` and use `replace()` to remove non-alphanumeric characters from it.
|
Convert string `toLowerCase()` and use `replace()` to remove non-alphanumeric characters from it.
|
||||||
Then, `split('')` into individual characters, `reverse()`, `join('')` and compare to the original, unreversed string, after converting it `tolowerCase()`.
|
Then, `split('')` into individual characters, `reverse()`, `join('')` and compare to the original, unreversed string, after converting it `tolowerCase()`.
|
||||||
|
|
||||||
```
|
```js
|
||||||
palindrome = str => (str.toLowerCase().replace(/[\W_]/g,'').split('').reverse().join('')==str.toLowerCase().replace(/[\W_]/g,''));
|
const palindrome = str => (str.toLowerCase().replace(/[\W_]/g,'').split('').reverse().join('')==str.toLowerCase().replace(/[\W_]/g,''));
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user