Skip to content

Instantly share code, notes, and snippets.

@nola
Created November 26, 2013 01:40
Show Gist options
  • Select an option

  • Save nola/7652131 to your computer and use it in GitHub Desktop.

Select an option

Save nola/7652131 to your computer and use it in GitHub Desktop.
JS operators shorthand
x=x+1;
minusCount = minusCount - 1;
y=y*10;
//shorthand version
x++;
minusCount --;
y*=10;
//Another way
//Other shorthand operators, given that x=10 and y=5, the table below explains the assignment operators:
x += y //result x=15
x -= y //result x=5
x *= y //result x=50
x /= y //result x=2
x %= y //result x=0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment