UNPKG

202 BJavaScriptView Raw
1function count(self, substr) {
2 var count = 0
3 var pos = self.indexOf(substr)
4
5 while (pos >= 0) {
6 count += 1
7 pos = self.indexOf(substr, pos + 1)
8 }
9
10 return count
11}
12
13module.exports = count
\No newline at end of file