Skip to content

Instantly share code, notes, and snippets.

@pixelstorm
Last active July 24, 2019 04:17
Show Gist options
  • Save pixelstorm/c876944e55d3b391309134f08835a0d2 to your computer and use it in GitHub Desktop.
Save pixelstorm/c876944e55d3b391309134f08835a0d2 to your computer and use it in GitHub Desktop.
javascript_cheatsheet
//operators
B O SM AS
operator precedent in javascript
Brackets pOwers (Division Multiple) (Addition Subtraction)
modulas operators give you the remainder (whatever is left) of any division
first it divides what it can
ie: 5 goes into 9 once with 4 left over
9 % 5 = 4
10 % 2 = 0 (there is nothing left over from the division)
modulas is good for finding odd or even numbers
+= 30
add to the existing values
-= 20
subtract from the existing values
*= 2
multiple existing values
/= 4
divide existing values
%= 4
modulas existing values
**= 4
"to the power of (4 x existing value 4 times)" existing values
the plus + operator also deals with strings
"string" + "string" = stringstring
polymorphism is like playdo.. it adapts to whatever shape you need
"string" + 10 = string10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment