Created
February 23, 2016 20:34
-
-
Save MihailoJoksimovic/b64f9798182a671e6521 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="ime-fajla.js"></script> | |
</head> | |
<body> | |
<button onclick="play(1);">Papir</button> | |
<button onclick="play(2);">Kamen</button> | |
<button onclick="play(3);">Makaze</button> | |
<script type="text/javascript"> | |
function getComputerChoice() { | |
var result = Math.floor((Math.random() * 3) + 1); | |
return result; | |
} | |
var play = function(userChoice) { | |
var computerChoice = getComputerChoice(); | |
alert("Korisnik je izabrao: " + userChoice + ", a kompjuter: " + computerChoice); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment