Challenge Check for Palindromes has an issue.
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/48.0.2564.116 Chrome/48.0.2564.116 Safari/537.36
.
Please describe how to reproduce this issue, and include links to screenshots if possible.
My code:
function palindrome(str) {
// Good luck!
var tmpStr = str.replace(/[\s,.!;]/g,"").toLowerCase().replace("-","_");
var reStr = tmpStr.split("").reverse().join("");
if (tmpStr === reStr){
return true;
}else{
return false;
}
}
palindrome("never-odd o_r even");
"0_0 (: /-\ :) 0-0" contains a escape symbol, so it actually is "0_0 (: /- :) 0-0", it isn't a palindrome string.
"0_0 (: /-\ :) 0-0"
contains a escape symbol, so it actually is"0_0 (: /- :) 0-0"
, it isn't a palindrome string.
Agreed. It isn't until you remove all the symbols.
Refer instructions:
Note
You'll need to remove all non-alphanumeric characters (punctuation, spaces and symbols) and turn everything lower case in order to check for palindromes.
Bonus hint: This one is a trick question :wink:
If you are still stuck please ask for help in the Help Chat
For passing this challenge, I must modify my code like this:
str.replace(/\W+|_/g,"")
But this is not the real intention. And when I am more in-depth, I find that I must process that pairs of symbol: "(" and ")", "<" and ">" , "{" and "}", "[" and "]". Oh, I would go nuts!
Lol yup! @ShenZQ I admit, I had to take two coffee's to solve this last test case! :sweat_smile:
@raisedadead I wait for your code. Lol!
ahhahaha got it) cool
Most helpful comment
Agreed. It isn't until you remove all the symbols.
Refer instructions:
Bonus hint: This one is a trick question :wink:
If you are still stuck please ask for help in the Help Chat