var a = [ 3, 2, 6, 2, 9, 4, 5, 3, 6, 5 ]; var b = a.reduce(function(x, y) { return x + (y == 5); }, 0); alert('вхождений ' +b)