Validate US Telephone numbers
https://www.freecodecamp.com/challenges/validate-us-telephone-numbers
One of the tests contains a number, that is correct by format, but should result in false. The reason seems to be, that this specific area code prefix does not exist according to this overview: http://www.allareacodes.com/650
Either the challenge needs to be extended into including external databases or the test needs to be adapted.
Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
Is it in the specs to test for area codes?
Now that is a bit much because I think the specs aren't all that great.
My feeling is, if it;s not in the specs, it should pass the test.
Otherwise you're testing the specs, not the code. And in the real world that would be great, but not here.
Hi @BleedingEnergy, thanks for reporting!
Challenge 312
Challenges are not numbered those are brownie points, which you earn by solving challenges and helping people in the chat rooms.
And @spieg you are perfectly correct in the argument. The aim of the challenge in not to be 'factually correct', we are aiming to teach a concept.
I am afraid we will close this a wont fix.
Happy coding!
Hi,
just in case I was missunderstood, I would like to reformulate the issue:
One of the tests is a number, that is invalid in the real world (since the area code prefix does not exist), but correct by testing against the concept. It should therefore pass the test, but it doesn't.
The reason for this seems to be, that the compared output of the test is taken from a real world number test, which includes the databases for valid numbers.
I would understand, the won't fix closing, if it were the other way around. Would be great, if you could check again :-)
Hi @BleedingEnergy,
Apologies, but yes the opening post leads to the analogy that we made prior closing.
We would be glad to re-open this thread and continue the discussion, mind pointing me to the exact test case, with actual and expected behaviours.
Thanks.
Hi raisedadead,
upon reviewing my code and checking the testcase (telephoneCheck("(6505552368)") should return false), I noticed the additional brackets "(number)". They were the reason the testcase should result in false.
However, if you could change the number inside of the brackets from 6505552368 to 6505562368, this might prevent the error from happening to someone else. 555 is not a valid area prefix for 650, while 556 is :-)
@FreeCodeCamp/moderators can any one tag help wanted, upon analyzing as valid change?
Hello humans! I hope you're all having a good day.
It took me a bit to understand what was going on, but I could see how this could cause confusion if you miss that the brackets are what should make the test fail.
While I don't think changing it is essential, I believe it could be a minor improvement. It could prevent people from being in the same situation as @BleedingEnergy, and I don't see how it could cause issues.
I'll take this and make the minor change.
Most helpful comment
I'll take this and make the minor change.