A Pen by stevenlundy

Thumbnail
This awesome code was written by stevenlundy, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright stevenlundy ©

Technologies

  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  stevenlundy</title>
  
  
  
  
  
</head>

<body>

  <button id='count'>Push</button>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/stevenlundy/a-pen-by-stevenlundy-OVKOwa */

var gen;

(function(){
   var idMaker = function*(){
    var index = 0;
    $('#count').click(function(){
      console.log(gen.next().value);
    });
    while(index < 3)
      yield index++;

    
    console.log("NO MORE!!!");
    return "?";
  };
  gen = idMaker();
  gen.next();
  console.log("done");
})();

Comments