Quick Reference
This is a quick reference list of JavaScript operators with examples of how they are used.
- JavaScript – Arithmetic OperatorsJavaScript arithmetic operators are used to perform arithmetic between variables and/or values.
- JavaScript – Assignment OperatorsJavaScript assignment operators are used to assign values to variables.
- JavaScript – Comparison OperatorsJavaScript comparison operators are used in logical statements to determine equality or inequality between variables and/or values.
- JavaScript – delete OperatorThe delete operator deletes a property from an object. It deletes both the value of the property and the property itself.
- JavaScript – in OperatorThe in operator returns “true” if the specified property is in the specified object, or “false” if it is not.
- JavaScript – Increment/Decrement OperatorsJavaScript increment/decrement operators are used to increase or decrease a variable and/or value, and is often used in loops as a way to count iterations.
- JavaScript – instanceof OperatorThe instanceof operator returns true if the specified object is an instance of the specified object type.
- JavaScript – Logical OperatorsLogical operators are used to determine the logic between variables or values.
- JavaScript – String OperatorsIn JavaScript, the + operator, and the += operator can be used to concatenate (bring together) multiple strings, or strings and variables.
- JavaScript – Ternary OperatorThe ternary (conditional) operator assigns a value to a variable based on a condition.
- JavaScript – typeof OperatorThe typeof operator returns the type of a variable, object, function, or expression.
- JavaScript – void OperatorThe void operator evaluates an expression and returns undefined, and is often used to obtain the undefined primitive value, using “void(0)”.
JavaScript Notes:
- When using JavaScript, single or double quotation marks are acceptable and work identically to one another; choose whichever you prefer, and stay consistent
- JavaScript is a case-sensitive language; firstName is NOT the same as firstname
- Arrays count starting from zero NOT one; so item 1 is position [0], item 2 is position [1], and item 3 is position [2] … and so on
- JavaScript variables must begin with a letter, $, or _
- JavaScript variables are case sensitive (x is not the same as X)
We’d like to acknowledge that we learned a great deal of our coding from W3Schools and TutorialsPoint, borrowing heavily from their teaching process and excellent code examples. We highly recommend both sites to deepen your experience, and further your coding journey. We’re just hitting the basics here at 1SMARTchicken.