<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/1.5" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: JavaScript for each statement</title>
	<link>http://underlog.org/2006/07/16/157</link>
	<description></description>
	<pubDate>Fri, 25 Jul 2008 17:40:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=1.5</generator>

	<item>
		<title>by: Алек</title>
		<link>http://underlog.org/2006/07/16/157#comment-2037</link>
		<pubDate>Sun, 16 Jul 2006 10:41:16 +0800</pubDate>
		<guid>http://underlog.org/2006/07/16/157#comment-2037</guid>
					<description>for (var i in o) {
    alert(o[i]);
}

Не е толкова красиво като for each, но раоти навсякъде.</description>
		<content:encoded><![CDATA[	<p>for (var i in o) {<br />
    alert(o[i]);<br />
}</p>
	<p>Не е толкова красиво като for each, но раоти навсякъде.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Петьо</title>
		<link>http://underlog.org/2006/07/16/157#comment-2038</link>
		<pubDate>Sun, 16 Jul 2006 13:22:35 +0800</pubDate>
		<guid>http://underlog.org/2006/07/16/157#comment-2038</guid>
					<description>Бих ползвал prototype ако става за въпрос - там имат приятна each циклия. Другото хубаво, което мозилците са имплементирали (и може да бъде направено за IE) е &lt;a href=&quot;http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach&quot; rel=&quot;nofollow&quot;&gt;Array::forEach&lt;/a&gt;. Чиято имплементация би трябвало да изглежда горе долу така:

&lt;pre&gt;
if (!Array.prototype.forEach)
{
	Array.prototype.forEach = function (closure)
	{
		var context = arguments[1] || null;
		for (var i = 0; i &amp;lt; this.length; i ++)
		{
			arguments[0].call(context, this[i], i, this);
		}
	}
}

[1, 2, 3, 4].forEach(function (el){alert(el)})
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[	<p>Бих ползвал prototype ако става за въпрос - там имат приятна each циклия. Другото хубаво, което мозилците са имплементирали (и може да бъде направено за IE) е <a href="http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Objects:Array:forEach" rel="nofollow">Array::forEach</a>. Чиято имплементация би трябвало да изглежда горе долу така:</p>
	<pre>
if (!Array.prototype.forEach)
{
	Array.prototype.forEach = function (closure)
	{
		var context = arguments[1] || null;
		for (var i = 0; i &lt; this.length; i ++)
		{
			arguments[0].call(context, this[i], i, this);
		}
	}
}
	
[1, 2, 3, 4].forEach(function (el){alert(el)})
</pre>
]]></content:encoded>
				</item>
</channel>
</rss>
