@alfredo's response totally destroys the structure of functional programming using avoid effects by mutating values outside the function, the response of @ César is very good is the most common, you can also use an accumulator that has reduced.
const fruits = ["Banana", "Orange", "Apple", "Mango","Orange"];
const count = fruits.reduce((acumulator, current) => {
return current === 'Orange' ? acumulator + 1 : acumulator;
}, 0);
console.log(count);
Functional programming does not iterate, it uses recursion here, an example of how the map works inside
const map = ([head, ...tail], fn) => (
typeof head === 'undefined' ? [] : [fn(head), ...map(tail, fn)]
);
const result = map([1, 2, 3], (x) => x * 2)
console.log(result);
As you can see, an Array returns as does filter, that is why using .length with filter returns the count of the searched value