Yesterday, I was working through the Free Code Camp Bonefire, “Check for Palindromes.” My first question was, “What is a Palindrome?” A palindrome is a word or sentence that’s spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
When I first read the lesson, I thought, “Oh, this looks easy?” Then I started to think about what I needed to do:
- Turn everything to lowercase: “I can do that!”
- Remove all the white space: “Okay, I think I remember doing something with this.”
- Remove all non-alphanumeric characters: “hmmm, this could take a while”
- Reverse the string: “Pretty sure I’ve done this in another lesson.”
- Compare both strings to make sure they’re equal: “I can do that!”
I didn’t know exactly what I needed to do when I first looked at the project but I broke down the steps and started with the Free Code Camp process of, Read-Search-Ask. I read the provided documentation and completed items I knew or remembered working on in previous lessons like how to make everything lowercase and removing the white space. Then I started to work on removing all the other punctuation which I thought was going to take a long time to write but a quick search on Stack Overflow directed me to a piece of code which removes all non-alphanumeric characters. The second to last step was reversing the string which I completed in a previous Bonfire. Lastly, I had to compare the original lowercase string without any non-alphanumeric characters to it’s reverse to see if it was a palindrome.
It took a little less than an hour to complete during my lunch break but it’s always a great feeling to complete a piece of code. It’s the same feeling I get when I complete a book, race, or any meaningful project.
A real sense of accomplishment.