Tutorial by Examples

The unary plus (+) precedes its operand and evaluates to its operand. It attempts to convert the operand to a number, if it isn't already. Syntax: +expression Returns: a Number. Description The unary plus (+) operator is the fastest (and preferred) method of converting something into a n...
The delete operator deletes a property from an object. Syntax: delete object.property delete object['property'] Returns: If deletion is successful, or the property did not exist: true If the property to be deleted is an own non-configurable property (can't be deleted): false in non...
The typeof operator returns the data type of the unevaluated operand as a string. Syntax: typeof operand Returns: These are the possible return values from typeof: TypeReturn valueUndefined"undefined"Null"object"Boolean"boolean"Number"number"String&quot...
The void operator evaluates the given expression and then returns undefined. Syntax: void expression Returns: undefined Description The void operator is often used to obtain the undefined primitive value, by means of writing void 0 or void(0). Note that void is an operator, not a functio...
The unary negation (-) precedes its operand and negates it, after trying to convert it to number. Syntax: -expression Returns: a Number. Description The unary negation (-) can convert the same types / values as the unary plus (+) operator can. Values that can't be converted will evaluat...
The bitwise NOT (~) performs a NOT operation on each bit in a value. Syntax: ~expression Returns: a Number. Description The truth table for the NOT operation is: aNOT a01101337 (base 10) = 0000010100111001 (base 2) ~1337 (base 10) = 1111101011000110 (base 2) = -1338 (base 10) A bit...
The logical NOT (!) operator performs logical negation on an expression. Syntax: !expression Returns: a Boolean. Description The logical NOT (!) operator performs logical negation on an expression. Boolean values simply get inverted: !true === false and !false === true. Non-boolean val...
Unary operators are operators with only one operand. Unary operators are more efficient than standard JavaScript function calls. Additionally, unary operators can not be overridden and therefore their functionality is guaranteed. The following unary operators are available: OperatorOperationExampl...

Page 1 of 1