Skip to content

Instantly share code, notes, and snippets.

View robinsonlam's full-sized avatar
💭
Volleyball all day

Robinson Lam robinsonlam

💭
Volleyball all day
View GitHub Profile
@robinsonlam
robinsonlam / JSStructure.md
Last active November 13, 2015 01:58
Structuring your code in Javascript - Notes for WDI students to help with syntax

Code Structure

Here are some notes I've made to help you guys with your syntax. Think of it like a "cheatsheet". Some tips to remember:

  • Keep an eye on semicolons, usually control flow blocks (if blocks, for, while loops etc.) do not need a semicolon.
  • Keep an eye on your opening and closing brackets ( { & } ).
  • Be careful when using assignment operators ( = ) and equality operators ( == and === ). Assignment is for setting, equality is for comparing.
  • Keep an eye on quotation marks. Match doubles with doubles ( " ), singles with singles ( ' ).
    • Also: Watch when you're using apostrophes inside strings: var sentence = "You're weird";.
      Make sure you don't do this: var sentence = 'You're weird'; This will give you errors.
  • When checking conditions with logical operators ( &&, ||, ! ), you cannot combine your conditions.
  • Incorrect: if ( chicken === yummy && tasty )
@cdiggins
cdiggins / react-best-practices.md
Created January 25, 2018 16:20
React Best Practices