Unary operators in Javascript Objects
Anna

Anna @lujianna

About: Web Developer

Location:
Remote
Joined:
Dec 6, 2019

Unary operators in Javascript Objects

Publish Date: Jul 23 '20
4 1

A unary operator is an operation with only one operand.

Plus sign (+) can function as an Addition Operator and also as a Unary Version in Javascript Objects.

As an arithmetic addition operator: It takes numerical values (literals or variables) as their operands and return a single numerical value.

Both + and - operators have unary versions, where they operate only on one variable.
When used in this fashion, + returns the number representation of the object, while - returns its negative counterpart

The unary plus operator converts its operand to Number type.

The unary negation operator converts its operand to Number type and then negates it.

Comments 1 total

Add comment