https://www.freecodecamp.com/challenges/check-for-palindromes
The issue is in the introduction... of the challenge exercise...
"We'll also pass strings with special symbols, such as "2A3_3a2", "2A3 3a2", and "2_A3_3#A2"."
Should be "We will NOT"
@tommygebru Some of the tests do have special characters (ex. palindrome("0_0 (: /-\ :) 0-0")
) so the instructions seem correct to me. Also, they correspond to the note above that says
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.
Yeah but even in your response above the Note says remove spaces....
and the example i refer to says include spaces....
@tommygebru maybe I need more clarification. What example are you referring to? The goal of the exercise is to take the string passed in the parameter of the palindrome function and strip it of everything except alphanumeric characters. Then test if it's a palindrome. Could you explain more about the issue?
@dhcodes Im just saying instructions are not concise enough...
if anything removing both lines...
"We'll pass strings with varying formats, such as "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"."
may help...
and replacing it with a string or array of non-alphanumeric... also a link to regex would be great
But the very first line after Note says
_You'll need to remove all non-alpha numeric characters_ (with the rest of the entire paragraph describing in detail what that means).
imo, it's pretty clear; however, a middle ground could be to add a parenthetical _(to test)_ in the line in question.
Ex:
'We'll also pass strings (to test) with special symbols...'
Those lines give user some 'heads up' in terms of what should be removed, why, and how it's relevant to the challenge itself.
@tommygebru I'm still unclear on what the concern is on this challenge. Those two sentences you are suggesting to remove were added because some were unclear about the alphanumeric characters. We've tried to go for a balance between conciseness and ease of understanding.
However, I think I am kind of understanding your concern on conciseness? A way I think would "clear" things up is, as you suggested, to remove those two sentences and replace it with a code block
palindrome("racecar"); // returns true palindrome("RaceCar"); // returns true palindrome("race CAR"); // returns true palindrome("2A3*3a2"); // returns true palindrome("2A3 3a2"); // returns true palindrome("2_A3*3#A2"); // returns true
@erictleung Doesn't the test suite fill the same function?
@BerkeleyTrue yes, it does. Just trying to address the original issue, which I'm still unclear on...
Its as Berkeley says.... why give such an example... when we are already learning to use the "test suite"....
For me I am reviewing the basic algorithms and it didnt make much sense ... it would have simply been better to list nonalphanumeric... to show the wide range of characters that are not a-z & 0-9
also I think it would help to drop a link to regex so that there would be 3 links instead of 2
LOL why give an example of "test suite", if you provide "test suite" in the next line
Sorry@texas2010,I just think my code is lengthy and want a better code.
Happy coding!