true
,否则返回false
。
palindrome(回文),指在忽略标点符号、大小写和空格的前提下,正着读和反着读一模一样。
注意:"racecar"
、"RaceCar"
、"race CAR"
等等。
我们也会传入一些包含特殊符号的字符串,例如"2A3*3a2"
,"2A3 3a2"
和"2_A3*3#A2"
。
palindrome('eye')
应该返回一个布尔值。"
testString: assert(typeof palindrome("eye") === "boolean");
- text: "palindrome('eye')
应该返回 true。"
testString: assert(palindrome("eye") === true);
- text: "palindrome('_eye')
应该返回 true。"
testString: assert(palindrome("_eye") === true);
- text: "palindrome('race car')
应该返回 true。"
testString: assert(palindrome("race car") === true);
- text: "palindrome('not a palindrome')
应该返回 false。"
testString: assert(palindrome("not a palindrome") === false);
- text: "palindrome('A man, a plan, a canal. Panama')
应该返回 true。"
testString: assert(palindrome("A man, a plan, a canal. Panama") === true);
- text: "palindrome('never odd or even')
应该返回 true。"
testString: assert(palindrome("never odd or even") === true);
- text: "palindrome('nope')
应该返回 false。"
testString: assert(palindrome("nope") === false);
- text: "palindrome('almostomla')
应该返回 false。"
testString: assert(palindrome("almostomla") === false);
- text: "palindrome('My age is 0, 0 si ega ym.')
应该返回 true。"
testString: assert(palindrome("My age is 0, 0 si ega ym.") === true);
- text: "palindrome('1 eye for of 1 eye.')
应该返回 false。"
testString: assert(palindrome("1 eye for of 1 eye.") === false);
- text: 'palindrome("0_0 (: /-\ :) 0-0")
应该返回 true。'
testString: 'assert(palindrome("0_0 (: /-\ :) 0-0") === true);'
- text: "palindrome('five|\_/|four')
应该返回 false。"
testString: assert(palindrome("five|\_/|four") === false);
```