Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Unary Operators

A handful of unary operators round out the catalog:

LyknJSPurpose
(not x)!xLogical negation (surface form)
(typeof x)typeof xType string
(void 0)void 0Evaluate and return undefined
(delete obj:prop)delete obj.propRemove a property

typeof is a kernel operator — in surface code, you use type keywords on function boundaries rather than checking types manually. But typeof is occasionally useful for JS interop or debugging.

delete removes a property from an object. In surface code, prefer dissoc for immutable removal. delete mutates the original object.

Bitwise Operators

For completeness, and for the rare occasion when you need to manipulate bits:

LyknJSOperation
(& a b)a & bBitwise AND
(| a b)a | bBitwise OR
(^ a b)a ^ bBitwise XOR
(~ x)~xBitwise NOT
(<< a n)a << nLeft shift
(>> a n)a >> nSign-propagating right shift
(>>> a n)a >>> nZero-fill right shift

Bitwise operators convert their operands to 32-bit integers, perform the operation, and convert back. Most application code never uses them. They appear in cryptographic code, binary protocol handling, and the occasional performance trick like (| 0 x) for fast float-to-integer truncation.

If you need them, they’re here. If you don’t, this section has earned its keep by existing for the day you do.