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. It’s been available across browsers since 2015년 7월.
비트 NOT 연산자(~)는 피연산자의 비트를 반전시킵니다. 다른 비트 연산자와 마찬가지로 피연산자를 32비트 정수로 변환합니다.
피연산자는 32비트 정수로 변환되며 일련의 비트(0과 1)로 표현됩니다. 32비트를 넘어가는 숫자는 최상위 비트를 기준으로 하여 삭제합니다. 예를 들어 다음과 같은 32비트 이상인 정수는 32비트 정수로 변환됩니다.
Before: 11100110111110100000000000000110000000000001 After: 10100000000000000110000000000001피연산자의 각 비트는 반전됩니다.
NOT 연산에 대한 진리표는 다음과 같습니다.
| 0 | 1 |
| 1 | 0 |
32비트 정수 피연산자는 2의 보수에 따라 반전됩니다. 즉, 최상위 비트는 음수인 정수를 표현하는 데 사용합니다.
어떤 수 x에 대해 NOT 비트 연산을 하면 -(x + 1)의 결과를 도출합니다. 예를 들면 ~-5는 4로 계산됩니다.
32비트 표현을 사용하기 때문에 ~-1과 ~4294967295 (232 - 1) 의 결과가 둘 다 0으로 계산되는 점을 유의해주세요.
| ECMAScript® 2027 Language Specification # sec-bitwise-not-operator |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 3월 22일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.