function subStr(_substring, _string) { var found = _string.split(_substring)[0].length return found < _string.length } alert(subStr('ty', 'qwerty'))