<?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: JavaScript Tip: Running code in the dark</title>
	<atom:link href="http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 17 May 2012 07:43:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Saint Jude</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2476</link>
		<dc:creator>Saint Jude</dc:creator>
		<pubDate>Sun, 15 Jan 2006 11:58:16 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2476</guid>
		<description>The constructor function version has the edge for me because I have found that the earlier wrapped-in-parens version causes problems with prototype addition declarations in certain Javascript/JScript environments.

Re previous comment:

Gary, I&#039;m finding this to work out quite well, ..so far

&lt;code&gt;
new function foo(a)
{
    doo = function(){alert(a)}
}(4)
doo()
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>The constructor function version has the edge for me because I have found that the earlier wrapped-in-parens version causes problems with prototype addition declarations in certain Javascript/JScript environments.</p>
<p>Re previous comment:</p>
<p>Gary, I&#8217;m finding this to work out quite well, ..so far</p>
<p><code><br />
new function foo(a)<br />
{<br />
    doo = function(){alert(a)}<br />
}(4)<br />
doo()<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Simon</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2434</link>
		<dc:creator>Simon</dc:creator>
		<pubDate>Fri, 13 Jan 2006 12:17:57 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2434</guid>
		<description>Getting back to the window scope is straight forward too.
&lt;code&gt;
(function() {
  window.foo = &quot;whee&quot;;
  var bar = &quot;boo&quot;;
})();

alert(&quot;outside: &quot; + foo); // foo! but no bar.
&lt;/code&gt;

--
Simon</description>
		<content:encoded><![CDATA[<p>Getting back to the window scope is straight forward too.<br />
<code><br />
(function() {<br />
  window.foo = "whee";<br />
  var bar = "boo";<br />
})();</p>
<p>alert("outside: " + foo); // foo! but no bar.<br />
</code></p>
<p>&#8211;<br />
Simon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2419</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Thu, 12 Jan 2006 16:13:29 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2419</guid>
		<description>Or use:

new function() {
// do stuff
}

A little cleaner syntax and it can also be used in place of object literals if you want to use arbitrary code. (Explanation: It defines and calls a constructor in place.)

Side comment: Your banner ad is blinking on the left as I type. Very annoying.</description>
		<content:encoded><![CDATA[<p>Or use:</p>
<p>new function() {<br />
// do stuff<br />
}</p>
<p>A little cleaner syntax and it can also be used in place of object literals if you want to use arbitrary code. (Explanation: It defines and calls a constructor in place.)</p>
<p>Side comment: Your banner ad is blinking on the left as I type. Very annoying.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: snook.ca - a collection of tips, tricks and bookmarks in web development</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2414</link>
		<dc:creator>snook.ca - a collection of tips, tricks and bookmarks in web development</dc:creator>
		<pubDate>Thu, 12 Jan 2006 14:13:28 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2414</guid>
		<description>&lt;strong&gt;Dealing with JavaScript Scope&lt;/strong&gt;

Over at Ajaxian, they&#039;ve offered up a useful tip for dealing with code that exists in the global namespace and is conflicting with other scripts: move it into its own function. Example: (function() { // do you stuff here! })();...</description>
		<content:encoded><![CDATA[<p><strong>Dealing with JavaScript Scope</strong></p>
<p>Over at Ajaxian, they&#8217;ve offered up a useful tip for dealing with code that exists in the global namespace and is conflicting with other scripts: move it into its own function. Example: (function() { // do you stuff here! })();&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: meneame.net</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2409</link>
		<dc:creator>meneame.net</dc:creator>
		<pubDate>Thu, 12 Jan 2006 11:20:45 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2409</guid>
		<description>&lt;strong&gt;Ajaxian - un blog para programadores AJAX&lt;/strong&gt;

Ajaxian publica cada dia una media de dos articulos relacionados directamente con cÃ³digo AJAX. Interesante sobre todo su post llamado &quot;10 motivos por los cuales AJAX apareciÃ³ para quedarse&quot;

en inglÃ©s, claro...</description>
		<content:encoded><![CDATA[<p><strong>Ajaxian &#8211; un blog para programadores AJAX</strong></p>
<p>Ajaxian publica cada dia una media de dos articulos relacionados directamente con cÃ³digo AJAX. Interesante sobre todo su post llamado &#8220;10 motivos por los cuales AJAX apareciÃ³ para quedarse&#8221;</p>
<p>en inglÃ©s, claro&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Claus</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2407</link>
		<dc:creator>Claus</dc:creator>
		<pubDate>Thu, 12 Jan 2006 09:50:34 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2407</guid>
		<description>ajaxian: You need to do more than just define the function, you need to call it also for the code to actually run. The (...)(); is what it takes to invoke the nameless parameterless function defined.</description>
		<content:encoded><![CDATA[<p>ajaxian: You need to do more than just define the function, you need to call it also for the code to actually run. The (&#8230;)(); is what it takes to invoke the nameless parameterless function defined.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ajaxian</title>
		<link>http://ajaxian.com/archives/javascript-tip-running-code-in-the-dark/comment-page-1#comment-2406</link>
		<dc:creator>ajaxian</dc:creator>
		<pubDate>Thu, 12 Jan 2006 07:42:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=726#comment-2406</guid>
		<description>So, is it  namespaces or scope?
And what are those fancy parentheses around the function for?
Variable declared inside the function is not visible outside anyway.</description>
		<content:encoded><![CDATA[<p>So, is it  namespaces or scope?<br />
And what are those fancy parentheses around the function for?<br />
Variable declared inside the function is not visible outside anyway.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

