The - unary operator negates an integer:
-
let a = 1 -a // is `-1`
The ! unary operator logically negates a boolean:
!
let a = true !a // is `false`
Last updated 4 years ago