true
if the given string is a palindrome. Otherwise, return false
.
A palindrome is a word or sentence that's spelled the same way both forward and backward, ignoring punctuation, case, and spacing.
Note"racecar"
, "RaceCar"
, and "race CAR"
among others.
We'll also pass strings with special symbols, such as "2A3*3a2"
, "2A3 3a2"
, and "2_A3*3#A2"
.
palindrome("eye")
should return a boolean.
testString: assert(typeof palindrome("eye") === "boolean");
- text: palindrome("eye")
should return true.
testString: assert(palindrome("eye") === true);
- text: palindrome("_eye")
should return true.
testString: assert(palindrome("_eye") === true);
- text: palindrome("race car")
should return true.
testString: assert(palindrome("race car") === true);
- text: palindrome("not a palindrome")
should return false.
testString: assert(palindrome("not a palindrome") === false);
- text: palindrome("A man, a plan, a canal. Panama")
should return true.
testString: assert(palindrome("A man, a plan, a canal. Panama") === true);
- text: palindrome("never odd or even")
should return true.
testString: assert(palindrome("never odd or even") === true);
- text: palindrome("nope")
should return false.
testString: assert(palindrome("nope") === false);
- text: palindrome("almostomla")
should return false.
testString: assert(palindrome("almostomla") === false);
- text: palindrome("My age is 0, 0 si ega ym.")
should return true.
testString: assert(palindrome("My age is 0, 0 si ega ym.") === true);
- text: palindrome("1 eye for of 1 eye.")
should return false.
testString: assert(palindrome("1 eye for of 1 eye.") === false);
- text: 'palindrome("0_0 (: /-\ :) 0-0")
should return true.'
testString: 'assert(palindrome("0_0 (: /-\ :) 0-0") === true);'
- text: palindrome("five|\_/|four")
should return false.
testString: assert(palindrome("five|\_/|four") === false);
```