JavaScript: Get the count of a character repeated in a given string

Full stack developer (ReactJS, NodeJS, JavaScript, PHP, SQL)
const mainStr = 'str1,str2,str3,str4strings';
const repeatedStringCount = [...mainStr].filter(l => l === 's').length;
console.log(repeatedStringCount);
Output:
6




