Let's say I have a string: var a = 'testString';
Then I got the index of t
:
return a.indexOf('t');
That would give 0. Now I'm going to get the index of ''
:
return a.indexOf('');
That also gives 0, yet if I return a.charAt(0)
it returns 't'. How is it possible for a.indexOf('')
and a.indexOf('t')
both be 0?