Skip to content

Instantly share code, notes, and snippets.

@jamiewilson
Created January 13, 2016 21:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiewilson/653d8299578e97a63162 to your computer and use it in GitHub Desktop.
Save jamiewilson/653d8299578e97a63162 to your computer and use it in GitHub Desktop.
The Shorthand for Commonly Used Code

Math on number variables

growCount ++; // increment by 1
shrinkCount --; // decrement by 1
growCout += 10; // add 10
shrinkCount -= 20; // subtract 20
moreSweets *= 5; // multiply by 5
lessApple /= 2; // divide by 2

if/else (Ternary operator)

var canDrink = (myAge > legalAge) ? true : false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment