Skip to content

Instantly share code, notes, and snippets.

@dougamos
Created May 25, 2017 15:36
Show Gist options
  • Save dougamos/462445df62649cd75f5b486507acbde6 to your computer and use it in GitHub Desktop.
Save dougamos/462445df62649cd75f5b486507acbde6 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/gaqowo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style id="jsbin-css">
ul li {
list-style: none;
display: block;
padding: 10px;
border: 1px solid #aaa;
font-family: arial;
margin-top: -1px;
}
</style>
</head>
<body>
<ul id="questions"></ul>
<script id="jsbin-javascript">
var questionCount = 15;
var maxNumber = 12;
for (i = 0; i < questionCount; i++) {
var question = randomNumber() +
" " +
randomMultiplyText() +
" 2 =";
console.log(question);
$("#questions").append("<li>" + question + "</li>");
}
function randomNumber() {
return Math.floor(Math.random() * maxNumber) + 1;
}
function randomMultiplyText() {
var choices = ["x","times","multiplied by","lots of", "x", "x"];
var randomIndex = Math.floor(Math.random() * choices.length);
return choices[randomIndex];
}
</script>
<script id="jsbin-source-css" type="text/css">ul li {
list-style: none;
display: block;
padding: 10px;
border: 1px solid #aaa;
font-family: arial;
margin-top: -1px;
}</script>
<script id="jsbin-source-javascript" type="text/javascript">var questionCount = 15;
var maxNumber = 12;
for (i = 0; i < questionCount; i++) {
var question = randomNumber() +
" " +
randomMultiplyText() +
" 2 =";
console.log(question);
$("#questions").append("<li>" + question + "</li>");
}
function randomNumber() {
return Math.floor(Math.random() * maxNumber) + 1;
}
function randomMultiplyText() {
var choices = ["x","times","multiplied by","lots of", "x", "x"];
var randomIndex = Math.floor(Math.random() * choices.length);
return choices[randomIndex];
}
</script></body>
</html>
ul li {
list-style: none;
display: block;
padding: 10px;
border: 1px solid #aaa;
font-family: arial;
margin-top: -1px;
}
var questionCount = 15;
var maxNumber = 12;
for (i = 0; i < questionCount; i++) {
var question = randomNumber() +
" " +
randomMultiplyText() +
" 2 =";
console.log(question);
$("#questions").append("<li>" + question + "</li>");
}
function randomNumber() {
return Math.floor(Math.random() * maxNumber) + 1;
}
function randomMultiplyText() {
var choices = ["x","times","multiplied by","lots of", "x", "x"];
var randomIndex = Math.floor(Math.random() * choices.length);
return choices[randomIndex];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment