38 lines
879 B
HTML
38 lines
879 B
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<title>Document</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
<p id="USER"></p>
|
||
|
<p id="COMPUTER"></p>
|
||
|
<script>
|
||
|
let weapon;
|
||
|
let weapons = ["kő", "papír", "olló"];
|
||
|
let computer_choice = weapons[((Math.random() * 10) % 3).toFixed(0)];
|
||
|
do{
|
||
|
weapon = prompt("Kő - papír - olló").toLowerCase();
|
||
|
}while(!weapons.includes(weapon));
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
document.getElementById("USER").innerHTML = weapon;
|
||
|
document.getElementById("COMPUTER").innerHTML = computer_choice;
|
||
|
|
||
|
|
||
|
|
||
|
switch (weapon) {
|
||
|
case value:
|
||
|
|
||
|
break;
|
||
|
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|