arrCombine: function(arr){ var equalsByURL = function (sobj, tobj) { var flag = 'url' in sobj ? sobj['url'] === tobj['url'] : false; return flag; } var _targetArr = []; var tarObj = null; var curObj = null; var cur = 0; var length = arr.length; for(var i = 0; i < length; i ++ ){ curObj = arr[i]; if(!curObj) continue; for(var j = i + 1; j < length; j ++) { tarObj = arr[j]; if(!tarObj) continue; var flag = equalsByURL(curObj, tarObj); if(flag) { if(curObj.str) curObj.str += tarObj.str; //curObj.num += '_' + tarObj.num; var s = curObj.str.split(' '); s.pop(); s.sort(function(x,y){ x = parseInt(x); y = parseInt(y) return x - y; }); curObj.str = s.join(' ')+' '; arr[j] = undefined; } } _targetArr.push(curObj); arr[i] = undefined; } return _targetArr; }