W3Schools 튜토리얼을 P-Reinforce v3.1 포맷으로 위키화(영어 본문, 한/영 섹션 헤더). - Topic_HTML: 59문서 (튜토리얼+예제, 레퍼런스/메타 제외) - Topic_CSS: 190문서 (메인 + Advanced/Flexbox/Grid/RWD 전체) - Topic_JavaScript: 120문서 (코어 언어; Temporal/DOM상세/BOM/WebAPI/AJAX/jQuery/Graphics 등은 후속) 각 폴더 00_INDEX.md(MOC) 포함. 코드 verbatim, 미확인분은 "Not found in source" 표기. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
6.1 KiB
id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
| id | title | category | status | verification_status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | created_at | updated_at | review_reason | merge_history | tags | raw_sources | applied_in | github_commit | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| javascript-bitwise | JavaScript Bitwise | Frontend | draft | conceptual |
|
B | 0.87 | 2026-06-23 | 2026-06-23 |
|
|
JavaScript Bitwise
🎯 한 줄 통찰 (One-line insight)
JavaScript bitwise operators work bit-by-bit on the binary representation of numbers — even though numbers are stored as 64-bit floats, every bitwise operation is performed on 32-bit binary numbers and returns a standard number. [S1]
🧠 핵심 개념 (Core concepts)
- Seven bitwise operators — AND (
&), OR (|), XOR (^), NOT (~), zero fill left shift (<<), signed right shift (>>), and zero fill right shift (>>>). [S1] - 64-bit storage, 32-bit operations — JavaScript stores numbers as 64-bit floating point numbers, but all bitwise operations are performed on 32-bit binary numbers. [S1]
- NOT and signed shift can produce negatives —
~5returns-6, and-5 >> 1returns-3, because of two's complement representation. [S1] - Bitwise assignment operators — shift assignments (
<<=,>>=,>>>=) and bitwise assignments (&=,^=,|=) combine the operation with assignment. [S1] - Base conversion via bitwise — decimal-to-binary and binary-to-decimal can be done with
(dec >>> 0).toString(2)andparseInt(bin, 2).toString(10). [S1]
🧩 추출된 패턴 (Extracted patterns)
- Per-bit combination —
&,|,^compare each pair of bits;~inverts every bit. [S1] - Shift to multiply/divide by powers of two —
5 << 1doubles to10;5 >>> 1halves to2. [S1] - Unsigned coercion for printing —
(dec >>> 0)forces an unsigned 32-bit view before.toString(2)to render binary. [S1]
📖 세부 내용 (Details)
Bitwise Operators — JavaScript provides seven bitwise operators: [S1]
| Operator | Name | Description |
|---|---|---|
& |
AND | Sets each bit to 1 if both bits are 1 |
| |
OR | Sets each bit to 1 if one of two bits is 1 |
^ |
XOR | Sets each bit to 1 if only one of two bits is 1 |
~ |
NOT | Inverts all the bits |
<< |
Zero fill left shift | Shifts left by pushing zeros in from the right and let the leftmost bits fall off |
>> |
Signed right shift | Shifts right by pushing copies of the leftmost bit in from the left, and let the rightmost bits fall off |
>>> |
Zero fill right shift | Shifts right by pushing zeros in from the left, and let the rightmost bits fall off |
Note: JavaScript stores numbers as 64 bits floating point numbers, but all bitwise operations are performed on 32 bits binary numbers. [S1]
Bitwise AND — returns 1: [S1]
let x = 5 & 1;
Bitwise OR — returns 5: [S1]
let x = 5 | 1;
Bitwise XOR — returns 4: [S1]
let x = 5 ^ 1;
Bitwise NOT — returns -6: [S1]
let x = ~5;
Left Shift (<<) — returns 10: [S1]
let x = 5 << 1;
Signed Right Shift (>>) — returns -3: [S1]
let x = -5 >> 1;
Zero Fill Right Shift (>>>) — returns 2: [S1]
let x = 5 >>> 1;
Operator results summary (verbatim values from the page) [S1]
| Expression | Result |
|---|---|
5 & 1 |
1 |
5 | 1 |
5 |
5 ^ 1 |
4 |
~5 |
-6 |
5 << 1 |
10 |
-5 >> 1 |
-3 |
5 >>> 1 |
2 |
Bitwise assignment operators — the page documents shift assignment operators (<<=, >>=, >>>=) and bitwise assignment operators (&=, ^=, |=). [S1]
Converting Decimal to Binary [S1]
function dec2bin(dec){
return (dec >>> 0).toString(2);
}
Converting Binary to Decimal [S1]
function bin2dec(bin){
return parseInt(bin, 2).toString(10);
}
The page also includes binary-representation tables showing decimal values and their binary form, and two's-complement format for negative numbers. The exact full numeric contents of those tables were not captured verbatim in the fetched source rendering: Not found in source.
🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — the seven single-operator demonstrations and the dec2bin / bin2dec conversion helpers. No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Single bitwise operations (language: JavaScript):
let a = 5 & 1; // 1
let b = 5 | 1; // 5
let c = 5 ^ 1; // 4
let d = ~5; // -6
let e = 5 << 1; // 10
let f = -5 >> 1; // -3
let g = 5 >>> 1; // 2
Base conversion helpers:
function dec2bin(dec){
return (dec >>> 0).toString(2);
}
function bin2dec(bin){
return parseInt(bin, 2).toString(10);
}
⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.87
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: JavaScript Tutorial
- 관련 개념: JavaScript Operators, JavaScript Numbers, JavaScript BigInt, JavaScript Number Properties
- 참조 맥락: Referenced when working with flags, masks, low-level math, or base conversions.
📚 출처 (Sources)
- [S1] W3Schools — JavaScript Bitwise — https://www.w3schools.com/js/js_bitwise.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Bitwise" page (Astra wiki-curation, P-Reinforce v3.1 format).