functionstrCount(text,letter){if(!letter.length){return'a letter is required.';}returntext.split('').filter(i=>i===letter).length;}console.log(strCount('Hello world',''))// a letter is required.console.log(strCount('Hello world','l'))// 3
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
JavaScript