에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게 [공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류. 문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인). - Topic_Programming → Domain_Programming (내부 구조 보존) - Topic_Graphic → Domain_Design - Topic_Business → Domain_Product - Topic_General → Domain_General - _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning), Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing) - 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서) - 빈 폴더 정리 (memory/procedures) - 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5.9 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-scope | JavaScript Scope | Frontend | draft | conceptual |
|
B | 0.88 | 2026-06-23 | 2026-06-23 |
|
|
JavaScript Scope
🎯 한 줄 통찰 (One-line insight)
Scope determines the accessibility (visibility) of variables — JavaScript has three kinds: global, function, and block. [S1]
🧠 핵심 개념 (Core concepts)
- Scope = accessibility — scope determines where variables are visible and reachable in your code. [S1]
- Three scopes — JavaScript has global scope, function scope, and (since ES6) block scope. [S1]
letandconstare block scoped — variables declared withletandconstinside a block{ }cannot be accessed outside it;varis not block scoped. [S1]- Function scope applies to all three keywords —
var,let, andconstare all function-scoped when declared inside a function and cannot be accessed from outside. [S1] - Automatic globals are a trap — assigning a value to an undeclared variable makes it a global automatically, which is discouraged; strict mode prevents it. [S1]
- Lifetime — local (function) variables live only while the function runs; global variables live until the page/browser closes. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Declare in the narrowest scope — keep variables local to the function or block that uses them. [S1]
- Prefer block scope for safety — use
let/constinside blocks to confine variables and avoid leaks. [S1] - Avoid undeclared assignment — always declare before assigning to avoid creating accidental globals. [S1]
📖 세부 내용 (Details)
What is scope? Scope determines the accessibility (visibility) of variables. JavaScript has 3 types of scope: Block scope, Function scope, and Global scope. [S1]
Global Scope
Variables declared outside any function or block have global scope and can be accessed everywhere, whether declared with var, let, or const: [S1]
let carName = "Volvo";
// code here can use carName
function myFunction() {
// code here can also use carName
}
Function Scope (Local Scope) Variables declared inside a function are local to that function and cannot be accessed from outside. Each function creates a new scope, and all three declaration keywords behave the same way here: [S1]
function myFunction1() {
var carName = "Volvo"; // Function Scope
}
function myFunction2() {
let carName = "Volvo"; // Function Scope
}
function myFunction3() {
const carName = "Volvo"; // Function Scope
}
Block Scope
Before ES6 (2015), JavaScript had only global scope and function scope. ES6 introduced let and const, which provide block scope. Variables declared inside a { } block with let or const cannot be accessed from outside the block: [S1]
{
let x = 2;
}
// x can NOT be used here
Variables declared with var do not have block scope and can be accessed outside the block: [S1]
{
var x = 2;
}
// x CAN be used here
Automatically Global If you assign a value to a variable that has not been declared, it automatically becomes a global variable. This is discouraged. [S1]
Strict Mode In "strict mode", undeclared variables are not automatically global. [S1]
The Lifetime of JavaScript Variables The lifetime of a JavaScript variable starts when it is declared. Function (local) variables are deleted when the function completes. Global variables are deleted when you close the page (or browser window). [S1]
🛠️ 적용 사례 (Applied in summary)
The page's own snippets illustrate the rule directly: the same carName variable visible globally vs. confined inside myFunction1/2/3, and the contrast between let x (block scoped) and var x (leaks out of the block). No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Block scope with let/const (language: JavaScript):
{
let x = 2;
}
// x can NOT be used here
var ignores block scope:
{
var x = 2;
}
// x CAN be used here
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
varvs.let/constfor block scope — onlyletandconstare confined to the block;varescapes to the enclosing function/global scope. Chooselet/constto limit visibility. [S1]- Global vs. local — declare globally only when the value must be shared everywhere; otherwise keep variables local for shorter lifetime and fewer collisions. [S1]
⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
✅ 검증 상태 및 신뢰도
- 상태: draft
- 검증 단계: conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
- 신뢰 점수: 0.88
- 중복 검사 결과: 신규 생성 (New discovery)
🔗 지식 그래프 (Knowledge Graph)
- 상위/루트: JavaScript Tutorial
- 관련 개념: JavaScript var let const, JavaScript Code Blocks, JavaScript Hoisting, JavaScript Strict Mode
- 참조 맥락: Underpins decisions about where to declare variables and which keyword to use.
📚 출처 (Sources)
- [S1] W3Schools — JavaScript Scope — https://www.w3schools.com/js/js_scope.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Scope" page (Astra wiki-curation, P-Reinforce v3.1 format).