diff --git a/09_palindromes/solution/palindromes-solution.js b/09_palindromes/solution/palindromes-solution.js index bc5ef94..7950015 100644 --- a/09_palindromes/solution/palindromes-solution.js +++ b/09_palindromes/solution/palindromes-solution.js @@ -1,5 +1,5 @@ const palindromes = function (string) { - const processedString = string.toLowerCase().replace(/[^a-z]/g, ""); + const processedString = string.toLowerCase().replace(/[^a-z0-9]/g, ""); return processedString.split("").reverse().join("") == processedString; }; diff --git a/09_palindromes/solution/palindromes-solution.spec.js b/09_palindromes/solution/palindromes-solution.spec.js index e8d7e6a..6e31d91 100644 --- a/09_palindromes/solution/palindromes-solution.spec.js +++ b/09_palindromes/solution/palindromes-solution.spec.js @@ -24,4 +24,7 @@ describe('palindromes', () => { test('works with numbers in a string', () => { expect(palindromes('rac3e3car')).toBe(true); }); + test('works with unevenly spaced numbers in a string', () => { + expect(palindromes('r3ace3car')).toBe(false); + }); });