A simple way would be to split the string on the required word, the word for which we want to calculate the number of occurences, and subtract 1 from the number of parts:
function checkOccurences(string, word) { return string.split(word).length - 1;}const text="Let us see. see above, see below, see forward, see backward, see left, see right until we will be right"; const count=countOccurences(text,"see "); // 2