Something easy for most people but not me I go crazy with it html and java

Something easy for most people but not me I go crazy with it html and java
0

<!doctype html>

<h1>Spiritueux Wines and Liquors</h1>

<script>

    function validateEmail(){

        if (email_user().indexOf('@') == -1);

            alert("The email its valid .");

    }

    

    function email_user(){

        var text = prompt   ("What is your email?");

        return text;

    }

</script>
thats my code I need to validate my email when I run the function no matter What I type It will come the email is invalid its my third day learning java How do I do 2 functions to validate email with @ sign and if there is not @ sign present the output has say the email is invalid please edit my mistakes so I can see how its supposed to be and explain me why . Thank you for your help in advance

First you need to call validateEmail() function to execute the code inside the function and complete your if statement by using the following code :

<script>
    function validateEmail(){
        if (email_user().indexOf('@') == -1){
			alert("the email is invalid .");
		}
		else{
			alert("The email is valid .");
		}
    }
    function email_user(){
        var text = prompt   ("What is your email?");
        return text;
    }
	validateEmail()
</script>