How to make these simple javascript lines into a loop
<p>I'm just starting to learn javascript, and I've written the following code (coming from a php background):</p>

<pre><code>$(document).ready(function(){
$("#example-1").attr("rel","1");
$("#example-2").attr("rel","2");
$("#example-3").attr("rel","3");
});
</code></pre>

<p>I'm assuming that making it into something more like this would be faster and use less resources (even if it's miniscule):</p>

<pre><code>        jQuery(document).ready(function(){
foreach #example-X
 i++
        $("#exmaple-[i]").attr("rel","[i]");
    });
</code></pre>

<p>How can I do that?</p>
