<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<h1>Guessing game</h1>
<script>
function skipLine() {
document.write('<br><br><br><hr><br><br>');
}
function print(text) {
document.write('<big>' + text + '</big>');
skipLine();
}
var userName = 'Jhon';
var password = 'Jhon123';
var shots = 3;
var counter = 1;
while (counter <= shots) {
var writedUserName = prompt('Write your username please.');
var writedPassword = prompt('Write your password please.');
if (writedUserName == userName && writedPassword == password) {
alert(
'Welcome to system ' + userName + '. You can now browse the site.'
);
break;
} else {
if (counter == shots) {
alert('Sorry, you don´t have more shots');
} else {
alert('Sorry, your Username or password is incorrect. try again.');
}
}
counter++;
}
</script>
</body>
</html>