Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <script type="text/javascript">
- var minHeight = 150;
- var maxHeight = 190;
- var maxAge = 50;
- var minAge = 30;
- var johnHeight = Math.floor(Math.random() * (maxHeight - minHeight) + minHeight);
- console.log("John's height is: " + johnHeight);
- var markHeight = Math.floor(Math.random() * (maxHeight - minHeight) + minHeight);
- console.log("Mark's height is: " + markHeight);
- var jamesHeight = Math.floor(Math.random() * (maxHeight - minHeight) + minHeight);
- console.log("James' height is: " + jamesHeight);
- var johnAge = Math.floor(Math.random() * (maxAge - minAge) + minAge);
- console.log("John's age is: " + johnAge);
- var markAge = Math.floor(Math.random() * (maxAge - minAge) + minAge);
- console.log("Mark's age is: " + markAge);
- var jamesAge = Math.floor(Math.random() * (maxAge - minAge) + minAge);
- console.log("James' age is: " + jamesAge);
- var totalJohn = johnHeight + johnAge * 5;
- console.log("Total points John: " + totalJohn);
- var totalMark = markHeight + markAge * 5;
- console.log("Total points Mark: " + totalMark);
- var totalJames = jamesHeight + jamesAge * 5;
- console.log("Total points James: " + totalJames);
- if (totalJohn > totalMark && totalJohn > totalJames) {
- console.log("John wins the game with " + totalJohn + " points.");
- } else if (totalMark > totalJohn && totalMark > totalJames) {
- console.log("Mark wins the game with " + totalMark + " points.");
- } else if (totalJames > totalJohn && totalJames > totalMark) {
- console.log("James wins the game with " + totalJames + " points.");
- } else {
- console.log("It's a draw. Nobody wins the game");
- }
- </script>
- </head>
- <body>
- </body>
- </html>
Add Comment
Please, Sign In to add comment