Hello,
Please assist, I am getting an error for step 5 " The prompt method should be called while no @ symbol in the entered value"
Please see my code below.
<!DOCTYPE html>
<html>
<head>
<title>Modals practice</title>
</head>
<body>
<h2 style="text-align: center">Open console</h2>
<!-- internal script -->
<script>
let emailPrompt = 'Please, enter your email';
let email = 'www.example@live.com';
let newsLetter = 'Do you want to receive our newsletter?';
let trust = 'Thank you for trust.';
let noTrust = 'Maybe next time.';
for (let i = 0; i < email.length; i++) {
//initial prompt
prompt(emailPrompt);
// 2nd prompt w/ email value
prompt(emailPrompt, email);
// if @ symbol is present
if (email.includes('@'))
if (confirm(newsLetter)) {
alert(trust);
break;
// if no @ symbol
} else if (!email.includes('@')) {
prompt(emailPrompt);
break;
// confirm is false
} else alert(noTrust);
break;
}
</script>
</body>
</html>