<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: The &#8220;Last in a Loop&#8221; Bug</title>
	<atom:link href="http://scriptnode.com/article/the-last-in-a-loop-bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://scriptnode.com/article/the-last-in-a-loop-bug/</link>
	<description>Tips and tricks for web developers.</description>
	<lastBuildDate>Tue, 17 Aug 2010 14:15:22 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kent Brewster</title>
		<link>http://scriptnode.com/article/the-last-in-a-loop-bug/comment-page-1/#comment-247</link>
		<dc:creator>Kent Brewster</dc:creator>
		<pubDate>Tue, 25 Nov 2008 07:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=80#comment-247</guid>
		<description>This is neat, thanks!  Some suggestions:  

- label the items #0 through #4, so the alerts actually match the item numbers

- explain variable e on line 6. Is it set to currentLoopValue?  If so, how? When I delete it, it seems to run fine.

- expand the explanation of where currentLoopValue is coming from. Right, it&#039;s being passed from the value of i in the closure on line 9, but it&#039;s hard to spot the connection unless you know how closures work.</description>
		<content:encoded><![CDATA[<p>This is neat, thanks!  Some suggestions:  </p>
<p>- label the items #0 through #4, so the alerts actually match the item numbers</p>
<p>- explain variable e on line 6. Is it set to currentLoopValue?  If so, how? When I delete it, it seems to run fine.</p>
<p>- expand the explanation of where currentLoopValue is coming from. Right, it&#8217;s being passed from the value of i in the closure on line 9, but it&#8217;s hard to spot the connection unless you know how closures work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Recent Links Tagged With "function" - JabberTags</title>
		<link>http://scriptnode.com/article/the-last-in-a-loop-bug/comment-page-1/#comment-234</link>
		<dc:creator>Recent Links Tagged With "function" - JabberTags</dc:creator>
		<pubDate>Sat, 08 Nov 2008 12:34:11 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=80#comment-234</guid>
		<description>[...] is releasing Digital Cameras with Makeup Function Saved by ShadowOfTheAssylum on Fri 07-11-2008   The “Last in a Loop” Bug Saved by lihlii on Fri 07-11-2008   Isabel De Los Rios Calorie FAQs Saved by baruchin on Fri [...]</description>
		<content:encoded><![CDATA[<p>[...] is releasing Digital Cameras with Makeup Function Saved by ShadowOfTheAssylum on Fri 07-11-2008   The “Last in a Loop” Bug Saved by lihlii on Fri 07-11-2008   Isabel De Los Rios Calorie FAQs Saved by baruchin on Fri [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: daaku</title>
		<link>http://scriptnode.com/article/the-last-in-a-loop-bug/comment-page-1/#comment-139</link>
		<dc:creator>daaku</dc:creator>
		<pubDate>Thu, 28 Aug 2008 16:39:56 +0000</pubDate>
		<guid isPermaLink="false">http://scriptnode.com/?p=80#comment-139</guid>
		<description>I find the pattern kinda ugly too.. I&#039;ve like to use Array.prototype.forEach (not available in IE, but easy to fix):

var els = document.getElementById(&#039;last-one-example-2&#039;).getElementsByTagName(&#039;LI&#039;);

// convert to array since above returns a NodeList
var arr = Array.prototype.slice.call(els);

arr.forEach(function(el, index) {
    el.onclick = function(e) {
        alert(&#039;You clicked element #&#039; + index);
    }
});</description>
		<content:encoded><![CDATA[<p>I find the pattern kinda ugly too.. I&#8217;ve like to use Array.prototype.forEach (not available in IE, but easy to fix):</p>
<p>var els = document.getElementById(&#8217;last-one-example-2&#8242;).getElementsByTagName(&#8217;LI&#8217;);</p>
<p>// convert to array since above returns a NodeList<br />
var arr = Array.prototype.slice.call(els);</p>
<p>arr.forEach(function(el, index) {<br />
    el.onclick = function(e) {<br />
        alert(&#8217;You clicked element #&#8217; + index);<br />
    }<br />
});</p>
]]></content:encoded>
	</item>
</channel>
</rss>
