why the resulted i value is "0" for the below example and explain about that i parameter?
<p>In the below example text(function(i,origText){}) method has callback function with arguments as "i" and "origText" but where are they set from? how do they get values in them? why the resulted i value is "0"?</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;
&lt;/script&gt;
&lt;script&gt;
$(document).ready(function(){
  $("#btn1").click(function(){
    $("#test1").text(function(i,origText){
      return "Old text: " + origText + " New text: Hello world! (index: " + i + ")"; 
    });
  });
  $("#btn2").click(function(){
    $("#test2").html(function(i,origText){
      return "Old html: " + origText + " New html: Hello &lt;b&gt;world!&lt;/b&gt; (index: " + i + ")"; 
    });
  });
});
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;p id="test1"&gt;This is a &lt;b&gt;bold&lt;/b&gt; paragraph.&lt;/p&gt;
&lt;p id="test2"&gt;This is another &lt;b&gt;bold&lt;/b&gt; paragraph.&lt;/p&gt;
&lt;button id="btn1"&gt;Show Old/New Text&lt;/button&gt;
&lt;button id="btn2"&gt;Show Old/New HTML&lt;/button&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>Please Share ur valuable knowledge regarding about above with us...</p>
