<?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: Using literals</title>
	<atom:link href="http://www.jspatterns.com/using-literals/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jspatterns.com/using-literals/</link>
	<description>Exploring common JavaScript patterns and anti-patterns</description>
	<lastBuildDate>Fri, 03 Feb 2012 21:54:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.3</generator>
	<item>
		<title>By: M S</title>
		<link>http://www.jspatterns.com/using-literals/#comment-5905</link>
		<dc:creator>M S</dc:creator>
		<pubDate>Fri, 22 Oct 2010 21:37:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=48#comment-5905</guid>
		<description>I don&#039;t know if this is accurate or not, but I always considered it a matter of situation and preference.  Defining your object as a function instead of a literal and using new is better suited for a proper class that will be creating many instances of.

However if you&#039;re creating an object once and are unlikely to create it again, you might just define it inline in the scope where it&#039;s needed.

I&#039;m guessing that calling a function that returned an object literal is practically equivalent to calling new on the same function.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if this is accurate or not, but I always considered it a matter of situation and preference.  Defining your object as a function instead of a literal and using new is better suited for a proper class that will be creating many instances of.</p>
<p>However if you&#8217;re creating an object once and are unlikely to create it again, you might just define it inline in the scope where it&#8217;s needed.</p>
<p>I&#8217;m guessing that calling a function that returned an object literal is practically equivalent to calling new on the same function.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Oakes</title>
		<link>http://www.jspatterns.com/using-literals/#comment-2961</link>
		<dc:creator>Karl Oakes</dc:creator>
		<pubDate>Wed, 09 Jun 2010 12:45:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=48#comment-2961</guid>
		<description>Why is it better to use literals ? I can see it is more natural to use literals in an object based language, but don&#039;t understand why it is preferred, is the new operator more expensive in terms of instantiation? Surely they are doing the same thing ?</description>
		<content:encoded><![CDATA[<p>Why is it better to use literals ? I can see it is more natural to use literals in an object based language, but don&#8217;t understand why it is preferred, is the new operator more expensive in terms of instantiation? Surely they are doing the same thing ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JSPatterns.com &#187; Blog Archive &#187; A case against inheritance</title>
		<link>http://www.jspatterns.com/using-literals/#comment-1343</link>
		<dc:creator>JSPatterns.com &#187; Blog Archive &#187; A case against inheritance</dc:creator>
		<pubDate>Mon, 14 Sep 2009 17:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=48#comment-1343</guid>
		<description></description>
		<content:encoded><![CDATA[<p>[...] easy to follow this advice in JavaScript. Remember &#8211; no classes in JavaScript. And how about the object literal, how simple it is? If you can add functionality to your objects from elsewhere – why do you need [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JSPatterns.com &#187; Blog Archive &#187; Constructors</title>
		<link>http://www.jspatterns.com/using-literals/#comment-1339</link>
		<dc:creator>JSPatterns.com &#187; Blog Archive &#187; Constructors</dc:creator>
		<pubDate>Mon, 14 Sep 2009 17:16:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.jspatterns.com/?p=48#comment-1339</guid>
		<description>[...] simple way to create objects in JavaScript is using object literal notation. An other way, a bit more involved is to use a constructor [...]</description>
		<content:encoded><![CDATA[<p>[...] simple way to create objects in JavaScript is using object literal notation. An other way, a bit more involved is to use a constructor [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

