const recorrences = ['a', 'b', 'c', 'a', 'b','a'] .map(i => !!~i.indexOf('a')) .filter(i => i) .length; console.log(`recorrences ${recorrences}`) //recorrences 3