////请输入下列水果共出现的次数
var arr = ["apple","orange","apple","orange","pear","orange"];
function getCount(){
arr.reduce(function(){},{})
}
function getWordCnt(){
return arr.reduce(function(prev,next){
prev[next] = (prev[next] + 1) || 1;
return prev;
},{});
}
var arr = ["apple","orange","apple","orange","pear","orange"];
console.log(getWordCnt());