function countInstances(string, word) { return string.split(word).length - 1;}console.log(countInstances("This is a string", "is"))
↧
Answer by Brandon Frohbieter for How to count string occurrence in string?
↧