I have a method:
function isSubString(word,array){} This method, given an array of words and a word, tries if the word is a substring of the others words in array.
for(var i=0;i<array.length;i++){ if(JSON.stringify(array[i]).indexOf(JSON.stringify(word))>0){ return 1; } } return 0; For example array=['home','dog'] and word='ho';
Word ho is sub string of home but this method is wrong. Anyone can help me?
indexuse> -1or!== -1.