Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Validate Email Address (filename: validateemailaddr.html ) Write a function named isValidEmailAddr(emailAddr) that takes an email address as a parameter, checks if the email address is
Validate Email Address (filename: validateemailaddr.html)
Given a string, s, s.indexOf('@') will give you the leftmost index of the @ symbol. s.lastIndexOf('@') will give you the rightmost index. If the @ symbol is not present they will return -1. The functions will search for any parameter string you specify.
So, if you know the first and last index of '@', how can you tell if it only occurs once?
For example, if the @ is the first character, the address is invalid and return false.
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started