Operators

Unary minus (-)

Try the free JavaScript compiler

Converts the operand to a numeric value and negates it. BigInt is supported; Number may yield signed zero or NaN.

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(-"7");
JavaScript Reference