Fix typos and missing highlighting

This commit is contained in:
Angelos Chalaris
2017-12-12 16:25:13 +02:00
parent b7b9e9476e
commit 8ea78970b2
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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,''));
``` ```