Write a JS function that finds, how many times a given word, is used in a given sentence. Note that letter case does not matter – it is case-insensitive.
The input comes as 2 string arguments:
The first one will be the sentence
The second one – the word.
The waterfall was so high, that the child couldn’t see its peak.
How do you plan on achieving that? How? How can you even think of that?
There was one. Therefore I bought it. I wouldn’t buy it otherwise.
The output is a single number indicating the amount of times the sentence contains the word.