Santa's Phone Number Formatter ๐ ๐
๐ฏ Task Write a JavaScript function that takes a 10-digit phone number as input and formats it into the following structure:
๐ Requirements Accept a 10-digit string as input. Validate that the input is exactly 10 digits and contains only numbers. Return the formatted phone number in the structure (000) 000-0000. If the input is invalid, throw an error indicating the issue.
๐ Example Santaโs contact example: Input: "8005551212" Output: "(800) 555-1212"
๐ Project Structure HTML file: Provides a simple form for users to enter a phone number. CSS file: Adds visual styling to make the interface user-friendly. JavaScript file: Contains the logic for validating and formatting the phone number.
๐ How to Use Clone the repository to your local machine. Open the HTML file in your browser. Enter a 10-digit phone number in the provided input field. Click the "Format" button to view the formatted number or an error message ๐ โจ.