General documentation / cheat sheets for various languages and services

Literals

Integers

Three types:

  1. Hexadecimal (base 16): a token matching the regex ^0x[A-Fa-f0-9]+.
  2. Octal (base 8): a token matching the regex ^0[0-7]+. If a token has a leading zero, but also has any 8 or 9 digits, it will be interpreted as a decimal.
  3. Decimal (base 10): a token matching the regex [0-9]+.

Strings

There are several specific escapes:
string name decimal
\0Null 0
\bBackspace 8
\tTab 9
\nNew line 10
\vVertical tab 11
\fForm feed 12
\rCarriage return13
\"Double quote 34
\'Apostrophe 39
\\Backslash 92

Along with several character code escape sequences:

  1. Octal: Character codes between 0 and 255 (inclusive) can be represented by a backslash followed by one to three octal digits. E.g., "\123" == "S" and "\12" == "\n". The interpretation is greedy, so it will consume as many octal digits after the backslash as it can, i.e., "\127" == "W", but "\128" == "\n8", since 8 is not an octal digit.
  2. Hexadecimal: The same characters, those between 0 and 255, inclusive, can be represented by hexadecimal escapes, too. These have the prefix \x, and always require both digits. E.g., "\xFE" == "þ", "\x0a" == "\n".
  3. Unicode: All Unicode characters in the basic plane (0 through 65535) can be represented with the prefix \u, followed by four hexadecimal digits. E.g., "\u00FE" == "þ".

ES6 / ES7