I am looking for the number of occurences of two different patterns in a string. I am looking for fly
or flies
. I am able to find the occurrence of one, but not sure how to check for 2 different strings.
My attempt so far is
const flyCount = str => {
return (str.match(/fly/g) || str.match(/flies/g) || []).length;
}