Created
April 22, 2015 01:31
-
-
Save NoMan2000/c4a0f8b0f9b027354eb1 to your computer and use it in GitHub Desktop.
Convert from -1 to 0 with ~
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Works in javascript or PHP. | |
var foo = "foo"; | |
if (~foo.indexOf("f")) { | |
console.log(~foo.indexOf("f")); | |
console.log("Found it!"); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment