<?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 Programming Patterns</title>
	<atom:link href="http://www.klauskomenda.com/archives/2007/07/07/javascript-programming-patterns/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klauskomenda.com/archives/2007/07/07/javascript-programming-patterns/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 10 Mar 2010 06:54:55 +0100</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Greg Greenhaw</title>
		<link>http://www.klauskomenda.com/archives/2007/07/07/javascript-programming-patterns/comment-page-1/#comment-11607</link>
		<dc:creator>Greg Greenhaw</dc:creator>
		<pubDate>Tue, 07 Oct 2008 22:09:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.klauskomenda.com/archives/2007/07/07/javascript-programming-patterns/#comment-11607</guid>
		<description>thanks for the article. You can also easily clone a singleton object with this function.


clone: function (arr) 
	{
		if(typeof(arr)==&#039;null&#039; &#124;&#124; typeof(arr)==&#039;undefined&#039;) 
		 	return new Object();
		 	
		 	
		var i, _i, temp;
	    if(typeof arr !== &#039;object&#039;) 
	    	return arr;
	    
	    else 
	    {
	        if(arr.concat) 
	        {
	        	temp = [];
	            for(i = 0, _i = arr.length; i &lt; _i; i++)
	            	temp[i] = arguments.callee(arr[i]);
	        }
	        else 
	        {
	        	temp = {};
	            for(i in arr)
	            	temp[i] = arguments.callee(arr[i]);
	                   
	        }
	     return temp;
	    }
	}</description>
		<content:encoded><![CDATA[<p>thanks for the article. You can also easily clone a singleton object with this function.</p>
<p>clone: function (arr)<br />
	{<br />
		if(typeof(arr)==&#8217;null&#8217; || typeof(arr)==&#8217;undefined&#8217;)<br />
		 	return new Object();</p>
<p>		var i, _i, temp;<br />
	    if(typeof arr !== &#8216;object&#8217;)<br />
	    	return arr;</p>
<p>	    else<br />
	    {<br />
	        if(arr.concat)<br />
	        {<br />
	        	temp = [];<br />
	            for(i = 0, _i = arr.length; i &lt; _i; i++)<br />
	            	temp[i] = arguments.callee(arr[i]);<br />
	        }<br />
	        else<br />
	        {<br />
	        	temp = {};<br />
	            for(i in arr)<br />
	            	temp[i] = arguments.callee(arr[i]);</p>
<p>	        }<br />
	     return temp;<br />
	    }<br />
	}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
