function indexOf(str, val){
let strLen = str.length,
valLen = val.length
for(let i = 0; i < strLen; i++){
let matchLen = i + valLen
let matchStr = str.slice(i, matchLen)
if(matchLen > strLen){
return -1
}
if(matchStr === val){
return i
}
}
return -1
}