在nodeschool上看到这个问题function countWords(arr) {  return arr.reduce(function(countMap, word) {
    countMap[word] = ++countMap[word] || 1 // increment or initialize to 1
    return countMap
  }, {}) // second argument to reduce initialises countMap to {}}module.exports = countWords传入数据var inputWords = ['Apple', 'Banana', 'Apple', 'Durian', 'Durian', 'Durian']得到的结果{    //   Apple: 2,
    //   Banana: 1,
    //   Durian: 3
    // }实现这个过程的js原理是什么
                    
                    
                添加回答
举报
0/150
	提交
		取消
	