Update palindromes.js

Since we use toLowerCase() before using replace there is no need to use A-Z in our regex cause it will be impossible to have uppercase characters in the string.
This commit is contained in:
Pedro Ribeiro 2021-04-27 10:23:37 +01:00 committed by GitHub
parent 9a40c04726
commit 4ab845b9c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -1,5 +1,5 @@
const palindromes = function(string) { const palindromes = function(string) {
processedString = string.toLowerCase().replace(/[^A-Za-z]/g, ""); processedString = string.toLowerCase().replace(/[^a-z]/g, "");
return ( return (
processedString processedString
.split("") .split("")