function forEach(array,action){ ;i<array.length;i++) action(array[i]); } function reduce(combine,base,array){ forEach(array,function(element){ base=combine(base,element);}) return base; } function countZeroes(array){ function counter(total,element){…