Created
March 15, 2012 06:23
-
-
Save osdrv/2042453 to your computer and use it in GitHub Desktop.
different types compatibility
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
print( null + 1 ); // raises NullPointerException | |
print( "asdasd" + 123 ); // => asdasd123 | |
print( "asdasd" - 123 ); // raises NoSuchMethodException "-" | |
print( 0 / 0 ); // => NaN | |
print( "asd" * 3 ); // raises NoSuchMethodException "*" | |
print( "asd" / 3 ); // same | |
print( 3 * "asd" ); // raises NoSuchMethodException: method not found: 'mulFromInteger' | |
Static a () => 1; | |
print( a ); // => Closure | |
print( [ 123, 456 ] + [ 1 ] ); // raises NoSuchMethodException | |
print( { "q": "asd" } + { "r": "zxc" } ); // raises NoSuchMethodException |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment