(Javascript Implementation) — Time complexity: Worst Case: O(m*n) How it works: We’re going to create a function with a parameter for the givenString and a parameter for the pattern we’re looking for. First let’s create a counter to count how many matches do we find. Next, in order to compare the two strings, we need to create a…