Last active
October 28, 2017 20:53
-
-
Save pelid/49d145fae568c6124ca6cfb4816b458f to your computer and use it in GitHub Desktop.
JS headaches
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
> "5" - 3 | |
2 | |
> "5" + 3 | |
"53" // почему ?! | |
>'5' + + '3' | |
"53" // кажется, здесь все логично | |
> '5' + - '3' | |
"5-3" // ан нет | |
> 'foo' + + 'foo' | |
"fooNaN" // потрясающе! | |
// и еще немного магии | |
> var x = 3; | |
> '5' + x - x | |
50 | |
> '5' - x + x | |
5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment