Code character cheat sheet

Brackets

  • ( )

    • Bracket, round bracket, parentheses.

    • Used around function parameters in CSS and JavaScript.

    • (— open bracket.

    • )— close bracket.

  • [ ]

    • Square bracket.

    • Used around attribute selectors in CSS and with arrays and objects in JavaScript.

    • [— open square bracket.

    • ]— close square bracket.

  • { }

    • Curly brace, brace, moustache.

    • Used to open/close CSS rule sets or opening/closing objects and functions in JavaScript.

    • {— open curly brace.

    • }— close curly brace.

  • < >

    • Angle brackets, less than/greater than.

    • Used to start and end HTML tags.

    • <— open angle bracket, less than.

    • >— close angle bracket, greater than.

Quotes

  • "

    • Double quote.

    • Used around attributes in HTML, around some values in CSS, and around strings in JavaScript.

    • Called straight quotes because they aren’t typographically correct.

  • '

    • Single quote.

    • Used around attributes in HTML, around some values in CSS, and around strings in JavaScript.

    • Called straight quotes because they aren’t typographically correct.

  • “ ”

    • Double curly quote.

    • Not used in code, but used in content.

    • Proper typographic quotes.

    • — Mac shortcut:⌥[

    • — Mac shortcut:⌥⇧]

  • ‘ ’

    • Single curly quote, apostrophe.

    • Not used in code, but used in content.

    • Proper typographic quotes.

    • — Mac shortcut:⌥]

    • — Mac shortcut:⌥⇧]

  • `

    • Backtick

    • Used in Markdown to denote code blocks.

Slashes

  • /

    • Slash, forward slash.

    • Used in paths and URLs as a folder separator.

  • \

    • Backslash.

    • Used to escape characters in JavaScript.

  • |

    • Vertical pipe.

    • Used in CSS attribute selectors; and in conditions in JavaScript, meaning “or”.

Dashes

  • -

    • Dash, hyphen, minus.

    • Used as a word separator in files, a hyphen in content & a minus in math.

    • En-dash.

    • Used in content to represent a range.

    • Mac shortcut:⌥-

    • Em-dash.

    • Used in content to set a piece of text apart, or denote speech that’s been cut off.

    • Mac shortcut:⌥⇧-

Misc.

  • :

    • Colon.

    • Used immediately after property names in CSS, before the value. Used in object declarations in JavaScript.

  • ;

    • Semicolon.

    • Used at the end of each declaration/line in CSS and JavaScript.

  • #

    • Hash, pound-symbol.

    • Used to link to an ID, internally, in HTML, and as a symbol to denote an ID selector in CSS.

  • &

    • Ampersand, and-symbol.

    • Used to start entities in HTML; and in conditions in JavaScript, meaning “and”.

  • _

    • Underscore.

    • Can be used to separate words in file paths or function names in JavaScript.