he bitwise NOT operator

suggest change

The bitwise NOT (~) performs a NOT operation on each bit in a value.

Syntax:

~expression

Returns:

Description

The truth table for the NOT operation is:

1337  (base 10) = 0000010100111001 (base 2)
~1337 (base 10) = 1111101011000110 (base 2) = -1338 (base 10)

A bitwise not on a number results in: -(x + 1).

Examples

value (base 10) value (base 2) return (base 2) return (base 10) Title
2 10 11111100 -3  
1 1 11111110 -2  
0 0 11111111 -1  
-1 11111111 0 0  
-2 11111110 1 1  
-3 11111100 10 2  

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Unary Operators:
* Syntax
* he bitwise NOT operator

Table Of Contents
11 Arrays
12 Objects
14 Classes
16 Map
17 Set
21 Unary Operators
24 Loops
27 Date
29 Scope
30 AJAX
35 Cookies
41 JSON
44 Fetch
45 Modules
46 Screen
64 Console
68 Symbols
73 Modals
76 Events
86 Proxy
89 WeakMap
90 WeakSet
102 Tilde