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"
.
Remember to use Read-Search-Ask if you get stuck. Write your own code.
palindrome("eye")
should return a boolean.
testString: 'assert(typeof palindrome("eye") === "boolean", ''palindrome("eye")
should return a boolean.'');'
- text: palindrome("eye")
should return true.
testString: 'assert(palindrome("eye") === true, ''palindrome("eye")
should return true.'');'
- text: palindrome("_eye")
should return true.
testString: 'assert(palindrome("_eye") === true, ''palindrome("_eye")
should return true.'');'
- text: palindrome("race car")
should return true.
testString: 'assert(palindrome("race car") === true, ''palindrome("race car")
should return true.'');'
- text: palindrome("not a palindrome")
should return false.
testString: 'assert(palindrome("not a palindrome") === false, ''palindrome("not a palindrome")
should return false.'');'
- text: 'palindrome("A man, a plan, a canal. Panama")
should return true.'
testString: 'assert(palindrome("A man, a plan, a canal. Panama") === true, ''palindrome("A man, a plan, a canal. Panama")
should return true.'');'
- text: palindrome("never odd or even")
should return true.
testString: 'assert(palindrome("never odd or even") === true, ''palindrome("never odd or even")
should return true.'');'
- text: palindrome("nope")
should return false.
testString: 'assert(palindrome("nope") === false, ''palindrome("nope")
should return false.'');'
- text: palindrome("almostomla")
should return false.
testString: 'assert(palindrome("almostomla") === false, ''palindrome("almostomla")
should return 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, ''palindrome("My age is 0, 0 si ega ym.")
should return true.'');'
- text: palindrome("1 eye for of 1 eye.")
should return false.
testString: 'assert(palindrome("1 eye for of 1 eye.") === false, ''palindrome("1 eye for of 1 eye.")
should return false.'');'
- text: 'palindrome("0_0 (: /-\ :) 0-0")
should return true.'
testString: 'assert(palindrome("0_0 (: /-\ :) 0-0") === true, ''palindrome("0_0 (: /-\ :) 0-0")
should return true.'');'
- text: palindrome("five|\_/|four")
should return false.
testString: 'assert(palindrome("five|\_/|four") === false, ''palindrome("five|\_/|four")
should return false.'');'
```