Files
odin-javascript-exercises/09_palindromes/palindromes.js
T

17 lines
698 B
JavaScript
Raw Normal View History

2025-02-26 10:21:22 +09:00
const palindromes = function (checkString) {
const formattedString = checkString
.split("")
.filter(char => {return /[a-zA-Z0-9]/.test(char)})
.join("");
console.log("Original: " + formattedString.toUpperCase())
const reverseString = formattedString
.split("")
.reverse()
.join("");
console.log("Reverse: " + reverseString.toUpperCase())
return (formattedString.toUpperCase() === reverseString.toUpperCase())
2021-03-03 15:13:24 +13:00
};
2017-08-25 14:07:28 -05:00
// Do not edit below this line
2021-03-03 15:13:24 +13:00
module.exports = palindromes;