JS deduplicates an array of objects

这是从https://segmentfault.com/q/1010000006954351参考的,达到了我要去重的功能,可是具体的原理,我其实没懂,有大神可以指教一下吗?
var hash = {}; 
//arr is the array of objects to be repeated arr = arr.reduce(function(item, next) { hash[next.name] ? '' : hash[next.name] = true && item.push(next); return item }, []) console.log(arr);

  



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325996774&siteId=291194637