function subStrCount input needle offset length input input slice offs

1
2
3
4
5
6
function subStrCount (input,needle,offset,length) {
input = input.slice(offset, offset + length);
var a = input.split(needle);
return a.length - 1;
}
console.log(subStrCount("Good Golly Miss Molly", "ll", 7, 10));