이전 재구성 작업에서 Dev/ 폴더가 누락되었던 것을 반영. - Dev/Topic_Programming(중첩 폴더, 78개)은 Dev 자체 최상위 폴더들 (Architecture/Conventions/Engineering_Intelligence 등)과 완전 중복이라 제거. - Dev 최상위 엔지니어링 지식 폴더(Architecture/Conventions/Engineering_Intelligence/ Failure_Library/Generalized_Principles/Language/Pattern_Catalog/Platform_Guides/ Subsystems, 77개)는 이미 Topic_Programming/Topic_Programming에 더 최신 버전이 존재해 중복 제거(고유 콘텐츠 1개는 예외 처리하여 이동 보존). - Dev의 W3Schools 언어 튜토리얼 폴더(Topic_C/CPP/CSS/CSharp/HOWTO/HTML/Java/ JavaScript/PHP/Python/SQL/W3CSS, 1201개)는 전부 Topic_Programming 하위로 이동. - 에이전트 운영 상태(.astra/docs)는 그대로 유지, 콘텐츠 폴더만 정리. - Topic_Programming 최종 문서 수: 2784 → 3985.
5.6 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-logical-operators | JavaScript Logical Operators | Frontend | draft | conceptual |
|
B | 0.89 | 2026-06-23 | 2026-06-23 |
|
|
JavaScript Logical Operators
🎯 한 줄 통찰 (One-line insight)
Logical operators (&&, ||, !) combine boolean expressions into more complex logic, while ?? returns a fallback only when the left operand is nullish (null or undefined). [S1]
🧠 핵심 개념 (Core concepts)
- Combine boolean expressions — logical operators are used to combine boolean expressions and to modify the results of comparisons. [S1]
&&(AND) — true only when both operands are true. [S1]||(OR) — true when at least one operand is true. [S1]!(NOT) — inverts a boolean result. [S1]??(Nullish coalescing) — returns the right operand when the left operand is nullish (nullorundefined); otherwise returns the left operand. [S1]- Nullish ≠ falsy —
??checks specifically fornull/undefined, so values like0,"", andfalseare preserved. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Condition + combinator — use a comparison operator to check a condition and a logical operator to combine conditions into more complex logic. [S1]
- Nullish-safe default — use
??when an empty string orfalseis an acceptable value and onlynull/undefinedshould trigger the fallback. [S1]
📖 세부 내용 (Details)
Logical operators [S1] Logical operators are used to combine boolean expressions. Logical operators can be used to modify the results of comparisons. Typically, you will use a comparison operator to check a condition, and a logical operator to combine conditions into more complex logic. Logical operators are used to determine the logic between variables or values.
Given x = 6 and y = 3:
| Operator | Name | Example |
|---|---|---|
| && | AND | (x < 10 && y > 1) is true |
| || | OR | (x === 5 || y === 5) is false |
| ! | NOT | !(x === y) is true |
AND (&&) example [S1]
let x = 6;
let y = 3;
let z = (x < 10 && y > 1)
OR (||) example [S1]
let x = 6;
let y = -3;
let z = (x > 0 || y > 0)
NOT (!) example [S1]
let x = (5 == 8);
let y = !(5 == 8)
The Nullish Coalescing Operator (??) [S1]
The ?? operator returns the right operand when the left operand is nullish (null or undefined), otherwise it returns the left operand.
let name = null;
let text = "missing";
let result = name ?? text;
When programming, a lot of values can be falsy (like 0, empty strings, false, undefined, null, NaN). However, sometimes you want to check if a variable is nullish (either undefined or null), like when it is okay for a variable to be an empty string or a false value. Then you can use the nullish coalescing operator.
Browser support [S1]
?? is an ES2020 feature. ES2020 is fully supported in all modern browsers since September 2020 (Chrome 85, Edge 85, Firefox 79, Safari 14, Opera 71).
🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — combining comparisons with && and ||, negating with !, and supplying a nullish-safe default with ??. No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Combine conditions with AND / OR:
let z = (x < 10 && y > 1)
let w = (x > 0 || y > 0)
Negate a result:
let y = !(5 == 8)
Nullish-safe default:
let name = null;
let text = "missing";
let result = name ?? text;
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
??vs||for defaults —||falls back on any falsy value (0,"",false,null,undefined,NaN), whereas??falls back only on nullish values (null/undefined). Choose??when an empty string orfalseis a valid value that should be preserved. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source. The ?? operator is noted as an ES2020 addition relative to the older &&/||/! operators.
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.89
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: JavaScript Tutorial
- 관련 개념: JavaScript Booleans, JavaScript Comparisons, JavaScript If Else, JavaScript Ternary
- 참조 맥락: Used to build compound conditions in
if/while/ternary expressions and to supply safe default values.
📚 출처 (Sources)
- [S1] W3Schools — JavaScript Logical Operators — https://www.w3schools.com/js/js_logical.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Logical Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).