← Back to challenges

Check if the String is a Palindrome

JavaScriptHardstringsvalidation

Instructions

A palindrome is a word, phrase, number or other sequence of characters which reads the same backward or forward, such as madam or kayak.

Write a function that takes a string and determines whether it's a palindrome or not. The function should return a boolean (true or false value).

Examples

isPalindrome("Neuquen") ➞ true

isPalindrome("Not a palindrome") ➞ false

isPalindrome("A man, a plan, a cat, a ham, a yak, a yam, a hat, a canal-Panama!") ➞ true

Notes

  • Should be case insensitive.
  • Special characters (punctuation or spaces) should be ignored.
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: GCD and LCM ( Part 1)