JavaScript Operators Reference

A concise guide detailing JavaScript operators, including arithmetic, comparison, logical, bitwise, assignment, and more.

javascript-operators-reference

JavaScript Operators Reference.

ARITHMETIC:

Arithmetic operators are used to perform arithmetic between variable and/or values.

ASSIGNMENT:

Assignment operators are used toi assign values to JavavScript variables.

STRING:

The +  operator, and the += operator can also be used to concatenatge (add) strings.

LOGICAL:

Logical operators are used to determine logic between the values of expressions or variables.

COMPARISON:

Comparison operators are used in logical statement to determine equality or difference between variables and values.

BITWISE:

In binary number system decimal number have an equivalent represente by a series of 0's and 1's. For example 5 is 0101 and 1 is 0001. Bitwise operators work on those bits, rather than number's decimal values. The << operator is the same as multiplying a whole number by 2 and >> operator is the same as dividing a whole number by 2. They are sometimes used as performance optimizations because they are faster than * and / operators in terms of processor cycles.

TYPEOF:

The typeof operator is used to check the type of a value. It will often evaluate to either primitive type, object or function. The value produced by the typeof operator is always string format. 
NaN (Not a Number) evaluates to 'number'. This is just one of many JavaScript quirks. NaN lives natively on Number. NaN - it is considered to be a primitive value. NaN is the symbol usually produced in the context of a numeric operation.

TERNARY (?:)

The ternary operator is like an inline if-statement. It does not support () brackets or multiple statements.\

DELETE:

The delete keyword can be used to delete an object property.

IN:

The in operator can be used to check if a property name exists in an object. The in operator, when used together with arrays, will check if an index exists. Note, it is ignorant of actual value (in either arrays or objects.) You can check for properties on built-in data types. The length property is native to all arrays The "length" property does not exist natively on an object unless it's added explicitly. Check for presence of constructor or prototype property on an object constructor function.

INSTANCEOF:

Returns true if the specified object is an instance of the specified object

GROUPING:

The grouping operator () controls the precedence of evaluation in expressions.

NEW:

You can use the new operator to create an instance of a user-defined object type or of one of the built-in object types.

VOID:

This operator allows evaluating expressions that produce a value into places where an expression that evaluates to undefined is desired.

COMMA OPERATOR:

The comma operator (.) evaluates both of its operands and returns the value of the last operand.

Like, Share and Subscribe #DevTools99 for more useful videos, tools info and #tutorials . Thank you!


DevTools99

Developer Co-Team

Let us make it easier for developers throughout the world to breathe. Let's keep things simple. Let's take it easy.