//Combined with ~, it can do a boolean check if an item exists in a string value var foo = "hello world"; if (~foo.indexOf("w")) { // item in list } else { // item not in list }
//Bitwise operator console.log(~-2); // 1 console.log(~-1); // 0 //Converting Strings to Numbers console.log(~~"-1"); // -1 console.log(~~"0"); // 0