For this challenge, write a function that encrypts phone numbers. The method should hide the last six digits of each phone number.
Example 1 (Using US phone number)
You can also have the code check the validity of the phone number's format.
Feel free to apply this challenge to phone numbers outside the USA as well.
This challenge comes from user otrebor6. Thank you to CodeWars, who has licensed redistribution of this challenge under the 2-Clause BSD License!
Want to propose a challenge for a future post? Email email@example.com with your suggestions!