Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<body>
<script>
  var myArray = ['Question 1', 'Test2', 'Practise 3'];
  var rand = Math.floor(Math.random() * myArray.length);
  function showquote() {
      document.getElementById('quote').innerHTML = myArray[rand];
  }
  //showquote();
</script>
<p>Click the button to trigger a function ".</p>
<button onclick="myFunction()">Generate question</button>
<p id="demo"></p>
<div id="quote"></div>
<script>
  function myFunction() 
  {
          showquote();               
  }
</script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers