| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Operators/Bitwise_NOT | [Back] [Original] |
Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.
NOT (~) . 32 .
const a = 5; // 00000000000000000000000000000101
const b = -3; // 11111111111111111111111111111101
console.log(~a); // 11111111111111111111111111111010
// Expected output: -6
console.log(~b); // 00000000000000000000000000000010
// Expected output: 2
~a
32 (0 1) . 32 . 32 32 .
Before: 11100110111110100000000000000110000000000001 After: 10100000000000000110000000000001
.
NOT .
| a | NOT a |
|---|---|
| 0 | 1 |
| 1 | 0 |
9 (base 10) = 00000000000000000000000000001001 (base 2)
--------------------------------
~9 (base 10) = 11111111111111111111111111110110 (base 2) = -10 (base 10)
32 2 . , .
x NOT -(x + 1) . ~-5 4 .
32 ~-1 ~4294967295 (232 - 1) 0 .
~0; // -1
~-1; // 0
~1; // -2
| Specification |
|---|
| ECMAScript 2027 LanguageSpecification # sec-bitwise-not-operator |
This page was last modified on 2025 3 22 by MDN contributors.
Your blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |