Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- phoneStr= '12345678912346';
- phoneStr.replace(/(d{3})(d{3})(d{4})(d{3})/, '($1) - $2 - $3 Ext - $4');
- let phoneStr= '12345678912346';
- let formatted = '(' + phoneStr.slice(0,3) + ') - ' + phoneStr.slice(3,6) + ' - ' + phoneStr.slice(6,10) + ' Ext - ' + phoneStr.slice(10,15);
- console.log(formatted);
Add Comment
Please, Sign In to add comment