Skip to content

Commit 76b186a

Browse files
committed
Nice one!
1 parent 0b37dce commit 76b186a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Telephone_Number_Validator/script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
function telephoneCheck(str) {
2+
// used regex in checking all required number
3+
let regex = /^1?\s?(\d{3}|\(\d{3}\))-?\s?\d{3}-?\s?\d{4}$/gm
4+
return regex.test(str);
5+
}
6+
7+
telephoneCheck("555-555-5555");

0 commit comments

Comments
 (0)