<?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: Extending Array</title>
	<atom:link href="http://mattsnider.com/languages/javascript/extending-array/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattsnider.com/languages/javascript/extending-array/</link>
	<description>Understanding JavaScript and Frameworks</description>
	<pubDate>Wed, 07 Jan 2009 11:54:33 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: kangax</title>
		<link>http://mattsnider.com/languages/javascript/extending-array/comment-page-1/#comment-19972</link>
		<dc:creator>kangax</dc:creator>
		<pubDate>Fri, 01 Aug 2008 15:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/extending-array/#comment-19972</guid>
		<description>ok, let's try again:

Array.prototype.unique = function() {
  var matches = [];
  for (var i=0, l=this.length; i&#60;l; i++) {
    if (matches.indexOf(this[i]) === -1) {
      matches.push(this[i]);
    }
  }
  return matches;
};</description>
		<content:encoded><![CDATA[<p>ok, let&#8217;s try again:</p>
<p>Array.prototype.unique = function() {<br />
  var matches = [];<br />
  for (var i=0, l=this.length; i&lt;l; i++) {<br />
    if (matches.indexOf(this[i]) === -1) {<br />
      matches.push(this[i]);<br />
    }<br />
  }<br />
  return matches;<br />
};</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kangax</title>
		<link>http://mattsnider.com/languages/javascript/extending-array/comment-page-1/#comment-19971</link>
		<dc:creator>kangax</dc:creator>
		<pubDate>Fri, 01 Aug 2008 15:52:42 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/extending-array/#comment-19971</guid>
		<description>First thing that comes to mind is something like:

Array.prototype.unique = function() {
  var matches = [];
  for (var i=0, l=this.length; i</description>
		<content:encoded><![CDATA[<p>First thing that comes to mind is something like:</p>
<p>Array.prototype.unique = function() {<br />
  var matches = [];<br />
  for (var i=0, l=this.length; i</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Matt Snider</title>
		<link>http://mattsnider.com/languages/javascript/extending-array/comment-page-1/#comment-19824</link>
		<dc:creator>Matt Snider</dc:creator>
		<pubDate>Wed, 30 Jul 2008 17:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/extending-array/#comment-19824</guid>
		<description>Kangax,

The unique method came out of a discussion with Christian Heilmann on his blog (Wait till I come). I cannot find the exact reference, so I am not sure if the article is still up.

Anyway, you are correct that unique doesn't handle a collection of like objects well... this would fail miserably on an array of JSON objects.

However, it works really well on arrays of simple data. If you know of a better method, I am always open to improving code, but I am looking for simple, readable/reliable, and fast code.</description>
		<content:encoded><![CDATA[<p>Kangax,</p>
<p>The unique method came out of a discussion with Christian Heilmann on his blog (Wait till I come). I cannot find the exact reference, so I am not sure if the article is still up.</p>
<p>Anyway, you are correct that unique doesn&#8217;t handle a collection of like objects well&#8230; this would fail miserably on an array of JSON objects.</p>
<p>However, it works really well on arrays of simple data. If you know of a better method, I am always open to improving code, but I am looking for simple, readable/reliable, and fast code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kangax</title>
		<link>http://mattsnider.com/languages/javascript/extending-array/comment-page-1/#comment-19134</link>
		<dc:creator>kangax</dc:creator>
		<pubDate>Wed, 23 Jul 2008 17:47:34 +0000</pubDate>
		<guid isPermaLink="false">http://mattsnider.com/languages/javascript/extending-array/#comment-19134</guid>
		<description>Matt,

What's the reason for making Array.prototype.unique rely on function decomposition? This makes any non-primitive value in an array disregarded as non-unique. This doesn't seem wise.

[{foo: true}, {foo: false}].unique(); // [{foo: true}]</description>
		<content:encoded><![CDATA[<p>Matt,</p>
<p>What&#8217;s the reason for making Array.prototype.unique rely on function decomposition? This makes any non-primitive value in an array disregarded as non-unique. This doesn&#8217;t seem wise.</p>
<p>[{foo: true}, {foo: false}].unique(); // [{foo: true}]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
