Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
<body>
<div id="counter">0</div>
<script>
incrementor = function() {
  this.num = 0;
  this.go = function() {
    this.num++;
    document.getElementById('counter').innerHTML = this.num;
    var that = this;
    setTimeout(function(){that.go()}, 1000);
  };
};
var inc = new incrementor();
inc.go();
</script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers