<?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: 6 Advanced JavaScript Techniques You Should Know</title>
	<atom:link href="http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/feed/" rel="self" type="application/rss+xml" />
	<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/</link>
	<description></description>
	<lastBuildDate>Fri, 12 Mar 2010 12:27:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Lyons Solutions Web Design</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-52795</link>
		<dc:creator>Lyons Solutions Web Design</dc:creator>
		<pubDate>Sun, 29 Nov 2009 13:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-52795</guid>
		<description>seems like I&#039;m not the only one who uses the 6th. lol</description>
		<content:encoded><![CDATA[<p>seems like I&#8217;m not the only one who uses the 6th. lol</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iresha</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-49581</link>
		<dc:creator>iresha</dc:creator>
		<pubDate>Mon, 26 Oct 2009 10:32:35 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-49581</guid>
		<description>These are some really advanced techniques.</description>
		<content:encoded><![CDATA[<p>These are some really advanced techniques.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: techprism</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48815</link>
		<dc:creator>techprism</dc:creator>
		<pubDate>Fri, 16 Oct 2009 14:15:03 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48815</guid>
		<description>Nice techniques,, helpful to me.</description>
		<content:encoded><![CDATA[<p>Nice techniques,, helpful to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louis</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48543</link>
		<dc:creator>Louis</dc:creator>
		<pubDate>Tue, 13 Oct 2009 04:58:24 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48543</guid>
		<description>@Mateu:

Yes, it looks like you&#039;re correct. In this case, probably the easiest thing to do would be to just check the existence of MY.CUSTOM before calling MY.CUSTOM.namespace().

More importantly, I hope the benefits of using some of these techniques was made clear enough. But thanks for spotting that.</description>
		<content:encoded><![CDATA[<p>@Mateu:</p>
<p>Yes, it looks like you&#8217;re correct. In this case, probably the easiest thing to do would be to just check the existence of MY.CUSTOM before calling MY.CUSTOM.namespace().</p>
<p>More importantly, I hope the benefits of using some of these techniques was made clear enough. But thanks for spotting that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: skim</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48476</link>
		<dc:creator>skim</dc:creator>
		<pubDate>Sun, 11 Oct 2009 21:15:54 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48476</guid>
		<description>In your closure example, aren&#039;t you implicitly making myMethodValue global?

I like creating closures this way (without the need to perform a &#039;new&#039; to the existing object):

var myObject = function() {
  var newValue = this.property1;
  return {
    property1 : &#039;value1&#039;;
    property2 : &#039;value2&#039;;
    performMethod : function() {
      var myMethodValue = newValue;
      return myMethodValue;
    };
  }
}</description>
		<content:encoded><![CDATA[<p>In your closure example, aren&#8217;t you implicitly making myMethodValue global?</p>
<p>I like creating closures this way (without the need to perform a &#8216;new&#8217; to the existing object):</p>
<p>var myObject = function() {<br />
  var newValue = this.property1;<br />
  return {<br />
    property1 : &#8216;value1&#8242;;<br />
    property2 : &#8216;value2&#8242;;<br />
    performMethod : function() {<br />
      var myMethodValue = newValue;<br />
      return myMethodValue;<br />
    };<br />
  }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mateu</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48416</link>
		<dc:creator>Mateu</dc:creator>
		<pubDate>Sun, 11 Oct 2009 04:31:45 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48416</guid>
		<description>Doesn&#039;t #4 have a bug?

if (typeof MY == &quot;undefined&quot;) {
  MY = new Object();
  MY.CUSTOM = new Object();
}

If MY is defined, but MY.CUSTOM isn&#039;t, then the next assignment should fail:

MY.CUSTOM.namespace = function() {

This would seem like a nitpick, but this would be exactly
the case if you have a set of several JS files in one namespace, and one of them has been included ahead of MY.CUSTOM.

FWIW, the idiom Dustin Diaz uses for this check looks cleaner to me:

var DED = window.DED &#124;&#124; {};

http://www.dustindiaz.com/javascript-private-public-privileged/

As Crockford points out, you shouldn&#039;t need to do
&quot;new Object()&quot;, you can just assign an object literal
with {}, or even start populating it straight away:

if (typeof MY.CUSTOM === &quot;undefined&quot;)
{
    MY.CUSTOM = {
       namespace : function() { ... }
    };
}

adéu,
Mateu</description>
		<content:encoded><![CDATA[<p>Doesn&#8217;t #4 have a bug?</p>
<p>if (typeof MY == &#8220;undefined&#8221;) {<br />
  MY = new Object();<br />
  MY.CUSTOM = new Object();<br />
}</p>
<p>If MY is defined, but MY.CUSTOM isn&#8217;t, then the next assignment should fail:</p>
<p>MY.CUSTOM.namespace = function() {</p>
<p>This would seem like a nitpick, but this would be exactly<br />
the case if you have a set of several JS files in one namespace, and one of them has been included ahead of MY.CUSTOM.</p>
<p>FWIW, the idiom Dustin Diaz uses for this check looks cleaner to me:</p>
<p>var DED = window.DED || {};</p>
<p><a href="http://www.dustindiaz.com/javascript-private-public-privileged/" rel="nofollow">http://www.dustindiaz.com/javascript-private-public-privileged/</a></p>
<p>As Crockford points out, you shouldn&#8217;t need to do<br />
&#8220;new Object()&#8221;, you can just assign an object literal<br />
with {}, or even start populating it straight away:</p>
<p>if (typeof MY.CUSTOM === &#8220;undefined&#8221;)<br />
{<br />
    MY.CUSTOM = {<br />
       namespace : function() { &#8230; }<br />
    };<br />
}</p>
<p>adéu,<br />
Mateu</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phaoloo</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48415</link>
		<dc:creator>Phaoloo</dc:creator>
		<pubDate>Sun, 11 Oct 2009 04:26:20 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48415</guid>
		<description>JavaScript Object Literal is new and helpful to me. I&#039;ve been working with many OOP languages and dunno JavaScript also support this essential feature.</description>
		<content:encoded><![CDATA[<p>JavaScript Object Literal is new and helpful to me. I&#8217;ve been working with many OOP languages and dunno JavaScript also support this essential feature.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: LEo</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48402</link>
		<dc:creator>LEo</dc:creator>
		<pubDate>Sat, 10 Oct 2009 18:44:42 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48402</guid>
		<description>No, I don&#039;t ^^</description>
		<content:encoded><![CDATA[<p>No, I don&#8217;t ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SD</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48401</link>
		<dc:creator>SD</dc:creator>
		<pubDate>Sat, 10 Oct 2009 18:21:17 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48401</guid>
		<description>very useful...great ..thanks a lot</description>
		<content:encoded><![CDATA[<p>very useful&#8230;great ..thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JavaScriptic</title>
		<link>http://sixrevisions.com/javascript/6-advanced-javascript-techniques-you-should-know/#comment-48399</link>
		<dc:creator>JavaScriptic</dc:creator>
		<pubDate>Sat, 10 Oct 2009 17:43:08 +0000</pubDate>
		<guid isPermaLink="false">http://sixrevisions.com/?p=1771#comment-48399</guid>
		<description>myMethodValue = newValue; in the 1st example is not necessary. In fact for a better example of the concept you can read http://yuiblog.com/blog/2007/06/12/module-pattern/</description>
		<content:encoded><![CDATA[<p>myMethodValue = newValue; in the 1st example is not necessary. In fact for a better example of the concept you can read <a href="http://yuiblog.com/blog/2007/06/12/module-pattern/" rel="nofollow">http://yuiblog.com/blog/2007/06/12/module-pattern/</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
