Question- Write a JavaScript program for the validation case using the RegExp method.
Allow a user to enter a 10-digit phone number in the given valid formats:
a- 1234567890
b- (123)456-7890 //no space before "4"
c- (123) 456-7890 //space before "4"
d- 123-456-7890
e- 123/456/7890
f- 123\456\7890
g- 123.456.7890
h- All other formats are invalid
If the user enters a valid phone number, convert it to the form (123)456-7890 (if it is not already in this form).
Full Rating to whoever can provide the correct JavaScript code for this validation case.