Operators

Bitwise not (~)

Try the free JavaScript compiler

Inverts bits. Number operands convert to signed 32-bit form; BigInt bitwise inversion uses arbitrary-length signed representation.

Formal Syntax & Structure

javascript syntaxjavascript
~value

Parameters & Attributes

NameTypeDescription
valueexpressionOperand to convert or invert.

Return Value

Number or BigInt

Converted result.

Working Example

Example Snippetjavascript
console.log(~5);
JavaScript Reference