标签:res class 对象 prot tun str prototype get ret
去除数组中重复的对象。
Array.prototype.getUnique = function() { var hash = {}, result = [], key; for ( var i = 0, l = this.length; i < l; ++i ) { key = JSON.stringify(this[i]); if ( !hash.hasOwnProperty(key) ) { hash[key] = true; result.push(this[i]); } } return result; }
标签:res class 对象 prot tun str prototype get ret
原文地址:http://www.cnblogs.com/baogp/p/7205003.html