I want to check if string b is completely contained in string a.
I tried:
var a = "helloworld"; var b = "wold"; if(a.indexOf(b)) { document.write('yes'); } else { document.write('no'); } The output is yes, it is not my expected output, because string b(wold) is not completely contained in string a(helloworld) --- wold v.s. world
Any suggestion to check the string?