JavaScript indexOf greater than -1 false when it's clearly not?
08:31 27 May 2014

The value of the field with the id 'post_url' is http://www.example.com/. Shouldn't JavaScript return true for anything greater than -1?

alert('1a = ' + id_('post_url').value.indexOf('http:')     ); // 0
alert('1b'    + id_('post_url').value.indexOf('http:') > -1); // false
alert('2a = ' + id_('post_url').value.indexOf('www.')      ); // 7
alert('2b'    + id_('post_url').value.indexOf('www.')  > -1); // false
javascript