Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div id='container'></div>
</body>
</html>
 
$(document).ready(function() {
  var words = ['a', 'b', 'c', 'd'];
  
  var getRandom = function() {
    var idx = Math.floor(Math.random() * words.length);
    // grabs word and removes it from the array
    return words.splice(idx, 1)[0];
  };
  
  var appendIfMore = function() {
    var word = getRandom();
    if (!word) return; // all done
   
    $('<div class="conversation"/>')
      .text(word)
      .appendTo('#container');
    
    var delay = Math.round(Math.random() * (3000 - 500)) + 500;
    setTimeout(appendIfMore, delay);
  };
  // start appending stuff
  appendIfMore();
  
});
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers