Currently on the wiki the second solution var regex = /^1?\s?(\(\d{3}\)|\d{3})?\s?-?\d{3}-?\s?\d{4}$/; also allows phone numbers without an area code.
I suggest to add an additional test that invalidates this
expect(telephoneCheck("555-5555")).to.equal(false);
Alternatively 555-5555 could be added as a valid format in the explanation of this bonfire.
I would like to take this one. Going to do a stream session of a couple PRs
Go ahead. You don't need to ask permission, just roll with it.
I think the preferred solution is to explicitly bar the 7 digit number. They should always include area code.
For anyone wanting to work on this, you'll need to add the following lines after this line:
"assert(telephoneCheck(\"555-5555\") === false, 'message: <code>telephoneCheck(\"555-5555\")</code> should return false.');",
"assert(telephoneCheck(\"5555555\") === false, 'message: <code>telephoneCheck(\"5555555\")</code> should return false.');",
Please first read the contributing guidelines before taking care of this issue. And feel free to visit the Contributors Help chat room if you have any questions about helping. We're there to help.
I'll take this one. Cheers!
@erictleung Quick question here. It's not enough to add two additional asserts. npm run test-challenges will fail because telephoneCheck doesn't return false for 7 digit numbers. Shall I go ahead and change the regex?
@b2m9 sounds good to me! 馃憤
Feedback on #8900 is highly appreciated. Thanks! 馃憤
5 month old issue with a proposed fix. We should accelerate this. I left a feedback, once addressed it gets a LGTM opinion from me.