From 07ced0fc05a1322818ee366f61c43e99e2d87418 Mon Sep 17 00:00:00 2001 From: billalp Date: Fri, 1 Nov 2019 14:14:18 +0000 Subject: [PATCH] All tests pass --- palindromes/palindromes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/palindromes/palindromes.js b/palindromes/palindromes.js index 4e88aa4..1800510 100644 --- a/palindromes/palindromes.js +++ b/palindromes/palindromes.js @@ -1,5 +1,5 @@ const palindromes = function(word) { - const wordArr = word.replace().toLowerCase().split(''); + const wordArr = word.replace(/\W/g, '').toLowerCase().split(''); const reversedArray = wordArr.reverse(); newArray = []; @@ -11,7 +11,7 @@ const palindromes = function(word) { break; } } - return true ? newArray.join('') === word : false; + return true ? newArray.join('') === word.replace(/\W/g, '').toLowerCase() : false; } module.exports = palindromes