Forked from brendomaciel/javascript_stranger_things.md
Created
September 22, 2016 01:42
-
-
Save felipeorlando/1cf7739b4ee250b4a70182a3266f077f to your computer and use it in GitHub Desktop.
JavaScript "Stranger Things"
This file contains hidden or 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
/** | |
* ATENÇÃO: | |
* | |
* O JavaScript possui uma série de "stranger things" em relação a algumas instruções. | |
* Portanto, tome cuidado se precisar utilizar qualquer uma dessas instruções listadas abaixo. | |
* | |
* Obs. 1: O ">" indica uma linha de instrução e a linha seguinte à essa indica o seu retorno. | |
* Obs. 2: O fato de o retorno não ser esperado ou óbvio, não quer dizer que, necessáriamente, ele seja um bug ou algo | |
* que passou despercebido pelas pessoas que matêm a linguagem e/ou interpretadores. | |
*/ | |
> 0.1 + 0.2 == 0.3 | |
false | |
> NaN == NaN | |
false | |
> 1/0 | |
Infinity | |
> -1/0 | |
-Infinity | |
> 0/-1 | |
-0 | |
> 0 == -0 | |
true | |
> a = 1 / "a" | |
NaN | |
> b = "b" | |
"b" | |
> isNaN(a) | |
true | |
> isNaN(b) | |
true | |
> typeof NaN | |
"number" | |
> [12, 2, 1].sort() | |
[1, 12, 2] | |
> [] + [] | |
"" | |
> [] + {} | |
"[object Object]" | |
> {} + [] | |
0 | |
> {} + {} | |
"[object Object][object Object]" | |
/** | |
* +---------------+-----------------+ | |
* | Testado em | Versão | | |
* +---------------+-----------------+ | |
* | Google Chrome | 53.0.2785.116 m | | |
* +---------------+-----------------+ | |
* | NodeJS | 4.4.3 | | |
* +---------------+-----------------+ | |
* | |
* Tabela gerada em: http://www.tablesgenerator.com/text_tables | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment