0

May someone help me with the following code, please. I try to return a function result in another function: alert("Your email is: " /*+ email of the user*/);

Spiritueux Wines and Liquors

<script>
    function check_user_age() {
        if (age_of_user() < 18)
            alert("You are too young to buy alcohol.");
    }

    function age_of_user() {
        var age = prompt("What is your age?");
        return age;
    }

    function check_user_mail() {
        if (email_of_user().includes("@"))
            alert("Your email is: " /*+ email*/);
        else alert("Your email should include an '@' symbol");
    }

    function email_of_user() {
        var email = prompt("What is your email?")
        return email;
    }
</script>

Ardahan Kisbet
  • 641
  • 1
  • 13
  • 33
fyardlest
  • 288
  • 4
  • 17
  • Does this answer your question? [Functions that return a function](https://stackoverflow.com/questions/7629891/functions-that-return-a-function) – Ardahan Kisbet Mar 23 '20 at 19:56
  • Something like this `var email = email_of_user(); if (email.includes("@")) { alert("Your email is: " + email); }` – frost-nzcr4 Mar 23 '20 at 21:13

0 Answers0