JSFiddle - React, Tailwind, and code Playground

JavaScript

var email = prompt('Enter your Email');
var re = /[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}/igm;
if (email == '' || !re.test(email))
{
    alert('Invalid email address.');
}
else {
    alert('Thank You, the email is valid!');
}