<?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>《巧妙去除数组中的重复项》的评论</title>
	<atom:link href="http://www.mytcer.com/357/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mytcer.com/357</link>
	<description></description>
	<lastBuildDate>Fri, 14 Jan 2011 14:47:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>作者：夜x</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-2160</link>
		<dc:creator>夜x</dc:creator>
		<pubDate>Tue, 14 Dec 2010 16:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-2160</guid>
		<description>非常聪明的方式，利用对象名称值不能重复来判断～～
译飞的方法很好</description>
		<content:encoded><![CDATA[<p>非常聪明的方式，利用对象名称值不能重复来判断～～<br />
译飞的方法很好</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：删除数组中重复项（uniq） ｜ 前端开发吧</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-190</link>
		<dc:creator>删除数组中重复项（uniq） ｜ 前端开发吧</dc:creator>
		<pubDate>Wed, 28 Apr 2010 01:36:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-190</guid>
		<description>[...] 详细分析，见同事 长天 的分享 《巧妙去除数组中的重复项》。 [...]</description>
		<content:encoded><![CDATA[<p>[...] 详细分析，见同事 长天 的分享 《巧妙去除数组中的重复项》。 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：Tcer</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-26</link>
		<dc:creator>Tcer</dc:creator>
		<pubDate>Sat, 26 Dec 2009 13:14:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-26</guid>
		<description>哈哈, 改进的好, 性能上再次提升了!</description>
		<content:encoded><![CDATA[<p>哈哈, 改进的好, 性能上再次提升了!</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：怿飞</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-25</link>
		<dc:creator>怿飞</dc:creator>
		<pubDate>Sat, 26 Dec 2009 11:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-25</guid>
		<description>又优化了下，将for (p in arr) 修改为：for(p=0;p&lt;len;p++)，详细见：http://www.planabc.net/2009/12/26/array_uniq/</description>
		<content:encoded><![CDATA[<p>又优化了下，将for (p in arr) 修改为：for(p=0;p&lt;len;p++)，详细见：http://www.planabc.net/2009/12/26/array_uniq/</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：怿飞</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-24</link>
		<dc:creator>怿飞</dc:creator>
		<pubDate>Sat, 26 Dec 2009 09:08:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-24</guid>
		<description>写错了一个地方：a.push(p);改为a.push(v);</description>
		<content:encoded><![CDATA[<p>写错了一个地方：a.push(p);改为a.push(v);</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：怿飞</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-23</link>
		<dc:creator>怿飞</dc:creator>
		<pubDate>Sat, 26 Dec 2009 09:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-23</guid>
		<description>思路不错，其实可以只遍历一次。
var uniq = function (arr) {
	var a = [],
		o = {},
		p,
		v,
		len = arr.length;
	if (len &lt; 2) {
		return arr;
	}
	for (p in arr) {
		v = arr[p];
		if (1 !== o[v]) {
			a.push(p);
			o[v] = 1;
		}
	}
	return a;
}</description>
		<content:encoded><![CDATA[<p>思路不错，其实可以只遍历一次。<br />
var uniq = function (arr) {<br />
	var a = [],<br />
		o = {},<br />
		p,<br />
		v,<br />
		len = arr.length;<br />
	if (len &lt; 2) {<br />
		return arr;<br />
	}<br />
	for (p in arr) {<br />
		v = arr[p];<br />
		if (1 !== o[v]) {<br />
			a.push(p);<br />
			o[v] = 1;<br />
		}<br />
	}<br />
	return a;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>作者：ada</title>
		<link>http://www.mytcer.com/357/comment-page-1#comment-22</link>
		<dc:creator>ada</dc:creator>
		<pubDate>Tue, 22 Dec 2009 02:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.mytcer.com/?p=357#comment-22</guid>
		<description>var toObject = function(a) {
      var o = {};
      for (var i=0, j=a.length; i&lt;j; i=i+1) { // 这里我调整了下, YUI源码中是i&lt;a.length
          if(Object.prototype.toString.apply(a[i]) === &quot;[object Array]&quot;) {
            o[a[i]] = toObject(a[i]) ;
          } else {
            o[a[i]] = true;
          }
      }
      return o;
};
var keys = function(o) {
      var a=[], i;
      for (i in o) {
           if (o.hasOwnProperty(i) &amp;&amp; typeof o[i] === &#039;object&#039;) { // 这里, YUI源码中是lang.hasOwnProperty(o, i)
               a.push(keys(o[i])) ;
           } else {
               a.push(i);
           }
      }
      return a;
};
var uniq = function(a) {
      return keys(toObject(a));
};</description>
		<content:encoded><![CDATA[<p>var toObject = function(a) {<br />
      var o = {};<br />
      for (var i=0, j=a.length; i&lt;j; i=i+1) { // 这里我调整了下, YUI源码中是i&lt;a.length<br />
          if(Object.prototype.toString.apply(a[i]) === &quot;[object Array]&quot;) {<br />
            o[a[i]] = toObject(a[i]) ;<br />
          } else {<br />
            o[a[i]] = true;<br />
          }<br />
      }<br />
      return o;<br />
};<br />
var keys = function(o) {<br />
      var a=[], i;<br />
      for (i in o) {<br />
           if (o.hasOwnProperty(i) &amp;&amp; typeof o[i] === &#039;object&#039;) { // 这里, YUI源码中是lang.hasOwnProperty(o, i)<br />
               a.push(keys(o[i])) ;<br />
           } else {<br />
               a.push(i);<br />
           }<br />
      }<br />
      return a;<br />
};<br />
var uniq = function(a) {<br />
      return keys(toObject(a));<br />
};</p>
]]></content:encoded>
	</item>
</channel>
</rss>

