Created
June 15, 2011 18:53
-
-
Save Rob-ot/1027804 to your computer and use it in GitHub Desktop.
javascript tilde operator with indexOf
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
> var a = ["a", "b"] | |
> a.indexOf("a") | |
0 | |
> a.indexOf("b") | |
1 | |
> a.indexOf("c") | |
-1 | |
> ~a.indexOf("a") | |
-1 | |
> ~a.indexOf("c") | |
0 | |
> !!~a.indexOf("a") | |
true | |
> !!~a.indexOf("c") | |
false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NodeJS on Win10. My chrome benchmark equals the bencmark from ISNIT0.
Just wondering why nodejs is ~2-3x faster.