Skip to content

Latest commit

 

History

History
67 lines (48 loc) · 1.61 KB

File metadata and controls

67 lines (48 loc) · 1.61 KB

Opertors and Loops

Assignment Operators

  • = assigns variable to a value
  • += adds value to existing value held in variable and assigns combined value to that variable
  • ** exponent
  • % remainder
  • x << y left shift assignment
  • x >> y right shift assignment
  • && = AND
  • || = OR
  • ?? = nullish coalescing operator

Destructuring: var [four, five, six] = 1 sets all elements of the list to 1

Comparison Operators

  • == equal to, returns true if values are equal
  • != not equal
  • === strict equal - true if operands are both equal and the same data type
  • !== strict not equal - true if operands are not equal but have the same data type, or have different data types
  • > greater than
  • < less than
  • >= greater than or equal to
  • <= less than or equal to

Arithmetic Operators

  • % remainder
  • ++ increment
  • -- decrement
  • - unary negation, returns negation of value
  • + unary plus, converts operand to a number, e.g. converts a string to a number
  • ** exponent operator

Booleans

  • && AND
  • || OR
  • ! NOT

Urnary Operators

  • delete deletes object's property
  • typeof returns objects data type
  • void evaluates an expression without returning a value

Relational Operators

  • in - checks for a property in an object

Loops and Iteration

  • for
  • do...while
  • while
  • for...in
  • for...of
  • labeled

Links