Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function count (str: string, search: string) {
let n = -1;
let i = 0;
while (i !== -1) {
i = str.indexOf(search, i + 1);
return n;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment