我自仰头向天笑,笑完我就去睡觉,哈哈哈哈……
摘要: 这个算法确实经典,做个笔记。 1 <script> 2 3 Array.prototype.unique = function() { 4 for( var a={}, i=0; i<this.length; i++ ) { 5 if( typeof( a[ this[i] ] ) === "undefined" ) { 6 a[ this[i] ] = 1; // a.1 = 1, a.2 = 1, a.3 = 1 7 } 8 } 9 this.length=0;10 for(i in a) {11 ... 阅读全文
posted @ 2012-09-22 18:19 轻轻的烟雾 阅读(181) 评论(0) 推荐(0) 编辑