Edit in JSFiddle

// The tilde operator is roughly equivalent to -(x + 1)
// which makes it suitable for the santinel value -1

var s = 'Hellow World!';

// traditionally
s.indexOf('Hell') !== -1; // true: 'Hell' exists
s.indexOf('Hull') !== -1; // false: 'Hull' does not exist

// with the unary operator tilde
~s.indexOf('Hell'); // true: -(0 + 1) is not falsy hence 'Hell' exists
~s.indexOf('Hull'); // false: -(-1 + 1) is falsy hence 'Hull' does not exist

// See more in the splendid book "You-Dont-Know-JS / types & grammar".