var string = 'qwe'; var substring = 'we'; alert(string.indexOf(substring) !== -1 ? 'found' : 'not found');