javascript
Word Operators

These are JavaScript's special/miscellaneous operators that don't fit neatly into arithmetic, comparison, or logical categories.

delete

Deletes any properties or objects passed to it. Returns true if the deletion was successful.

delete object.property;
delete object["property"];

in

Used in two contexts:

"property" in object; // true or false
for (var key in object) { ... }

instanceof

Returns a Boolean representing whether the first value is an instance of the right constructor.

value instanceof Constructor; // true or false

new

Returns a new instance of the constructor operand.

var obj = new Constructor();

typeof

Returns a string representing the argument's type. The possible return values cover only a subset of the literal types:

Type Result
Undefined "undefined"
Null "object"
Boolean "boolean"
Number "number"
String "string"
Function "function"
Anything else "object"

void

A legacy feature that returns undefined regardless of its operand. Occasionally used to suppress return values in javascript: URLs or to wrap a statement explicitly.

void 0;        // returns undefined
void(expr);    // evaluates expr, returns undefined