Would this not be a simpler solution?
          
          
            Challenges
            • Last reply from Team AlgoDaily at July 27, 2019 at  1:58AM UTC
            
          
          For the detect substring in a string problem, here was the solution offered: 
```js
        function detectSubstring {
            let idxOfStart = 0,
                j = 0;
        for  {
            // if match, compare next character of subStr ...