title: How check if a string is substring with indexof [JAVASCRIPT]
body: <p>I have a method:</p>
  
  <pre><code>function isSubString(word,array){}
  </code></pre>
  
  <p>This method, given an array of words and a word, tries if the word is a substring of the others words in array.</p>
  
  <pre><code>for(var i=0;i&lt;array.length;i++){
  
          if(JSON.stringify(array[i]).indexOf(JSON.stringify(word))&gt;0){
              return 1;
          }
      }
      return 0;
  </code></pre>
  
  <p>For example <code>array=['home','dog']</code> and <code>word='ho'</code>;</p>
  
  <p>Word <code>ho</code> is sub string of <code>home</code> but this method is wrong. Anyone can help me?</p>