I am trying to make an email validator and I want to make a command to check that the user input (the email the user enters) contains ONLY ONE OF "@" and ".". Example: name@@.com would be invalid
function validateEmail(){
let enterEmail = prompt("Enter your email to see if it is valid");
let removeSpace = (enterEmail.trim());
let s = removeSpace.indexOf('@');
let lastS = removeSpace.lastIndexOf('.');
if (s > 1 && lastS > 1) {
Output("emailOutput", "The Email you have entered is valid");
}
else {
Output("emailOutput", "The Email you have entered is invalid");
}
}