var a = 'earthling'; var b = a.indexOf('t');//b = 3 its zero based var c = a.indexOf('hl');//c = 4
Output: