var a = [ 2, 5, 4, 7, 3, 5, 3, 4, 8, 8, ]; var b = 5; var result = a.filter(function(v) { return v === b; }).length; alert(result + " вхождения");