title: What is the equivalent of Java's final in javascript
body: <p>Here is my code that is not working correctly:</p>
  
  <pre><code>$(document).ready(function() {
      for (var i = 0; i &lt; 3; i++) {
          var bt = new HrButton("btn" + i);                    
          bt.setOnclick(function() {
              alert(bt.name + " clicks = " + bt.cntClick);
              bt.cntClick = bt.cntClick + 1;
          });
          $("#container").append(bt.toHtml());
      }
  });
  </code></pre>
  
  <p>How can I maintain three instances of <code>bt</code> within the function. As it stands now <code>bt</code> refers to <code>btn2</code> in each onclick.</p>