Skip to content

Instantly share code, notes, and snippets.

@LtAstros
Created April 20, 2017 23:24
Show Gist options
  • Save LtAstros/98447eae52d5f7cee448097907837e77 to your computer and use it in GitHub Desktop.
Save LtAstros/98447eae52d5f7cee448097907837e77 to your computer and use it in GitHub Desktop.
Exported from Popcode. Click to import: https://popcode.org/?gist=98447eae52d5f7cee448097907837e77
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<input><button>Submit</button>
<div>You guessed:</div><div id="word"></div>
<div id="WL"></div>
<div id="img"></div>
</body>
</html>
{"enabledLibraries":["jquery"]}
var answer = Math.floor((Math.random() * 10) + 1);
$("button").click(function() {
var guessString = $("input").val();
var guess = parseInt(guessString);
$("#img").html(" ");
if (answer === guess) {
$("#WL").html("you win");
$("#img").html("<img src = 'https://goo.gl/6CCey3'>");
} else if (guess === 1337) {
$("#WL").html("THIS IS SUPER SECRET shhhhh");
} else if (answer > guess) {
$("#WL").html("too low :(");
} else if (answer < guess) {
$("#WL").html("too high :(");
} else {
$("#WL").html("INPUT IS INVALED ERRROOOOOR ERRRROOOOOR DOES NO COMPUT3#$$#$#%*$#*$#*$#");
}
});
body {
background-color: darksalmon;
font-family: "comic sans MS";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment