Return true if the given string is a palindrome. Otherwise, return false.
Note: You'll need to remove all non-alphanumeric characters (punctuation, spaces and symbols) and turn everything into the same case (lower or upper case) in order to check for palindromes.
- write pseudocode
- figure out palindrome function
- create regex to clean up input
- call function inside other function
- JS
reverse()
came in super handy.- If I hadn't come across that I probably would have created an array and created a loop to split the str, unshift each letter into new string, and then join.
let regexFunction = (str) => {
let textLowerCase = str.toLowerCase();
let cleanStr = textLowerCase.replace(/[^a-z0-9]/gi, '');
return cleanStr;
}
- I remembered to use the
.toLowerCase()
from my email generator
- I want to create a UI to display:
- client side input
- revesed input
- is palindrome? true / false
- Create my own tests from expected results given
- Three Ways to Reverse a String in JavaScript - I felt like this basically told me the answer lol but then realized that I still needed to match the original input to the the reversed input.
- Conditional (ternary) operator - I iwanted to use the ternary notation because someone that paired with me did in a previous project.
- How to use a return value in another function in Javascript? - This was pretty basic but I had all of my pieces figured out and couldn't understand how to piece the functions together.
- Github - @sadiejay
- Class Cohorts fCC bootcamp cohort got me my start and now I'm finishing up!