利用reduce实现 concat
var arr=[6,9,7,4,5];
var str=arr.reduce(function(value,item,index,arr){
return value+"$"+item;
});
console.log(str);
利用reduce实现 every
var arr=[6,9,7,4,5];
var bool=arr.reduce(function(value,item){
return value && item>3;
},true);
console.log(bool);
利用reduce实现 some
var arr=[6,9,7,4,5];
var bool=arr.reduce(function(value,item){
return value || item>10;
},false);
console.log(bool);
利用reduce实现 filter
var arr=[6,9,7,4,5];
var arr1=arr.reduce(function(value,item){
if(item>5) value.push(item);
return value;
},[])
console.log(arr1);