에이전트 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>
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-loops | JavaScript Loops | Frontend | draft | conceptual |
|
B | 0.88 | 2026-06-23 | 2026-06-23 |
|
|
JavaScript Loops
🎯 한 줄 통찰 (One-line insight)
Loops let you run the same block of code many times, each time with a different value — replacing long repetitive sequences with a compact iteration. [S1]
🧠 핵심 개념 (Core concepts)
- Loops repeat a block of code — they execute a code block multiple times, often with a different value each pass. [S1]
forloop — uses three expressions: an initializer, a condition, and an update run after each iteration. [S1]whileloop — runs as long as a specified condition is true. [S1]do/whileloop — a variant that runs the block at least once before checking the condition. [S1]- Loop scope — variables declared with
letinside a loop are visible only within the loop, unlikevar. [S1] - Infinite-loop hazard — forgetting to update the condition variable means the loop never ends and crashes the browser. [S1]
🧩 추출된 패턴 (Extracted patterns)
- Replace repetition with iteration — instead of writing the same statement for each array index, loop over
cars.length. [S1] - Index accumulation — append each iteration's value into a result string (
text += ...). [S1] - Always advance the condition variable — increment (e.g.
i++) so the condition eventually becomes false. [S1]
📖 세부 내용 (Details)
Why loops [S1] Loops are handy if you want to run the same code over and over again, each time with a different value. Instead of writing the same statement many times:
text += cars[0] + "<br>";
text += cars[1] + "<br>";
text += cars[2] + "<br>";
text += cars[3] + "<br>";
text += cars[4] + "<br>";
text += cars[5] + "<br>";
You can write:
for (let i = 0; i < cars.length; i++) {
text += cars[i] + "<br>";
}
The for loop [S1]
The for loop has the syntax for (expr1; expr2; expr3) { // code block to be executed }.
for (let i = 0; i < 5; i++) {
text += "The number is " + i + "<br>";
}
Loop scope — var vs let [S1]
Using var in a loop, the loop variable redeclares the outer variable:
let i = 5;
for (i = 0; i < 10; i++) {
// some code
}
// Here i is 10
Using let in a loop, the loop variable is scoped only to the loop:
let i = 5;
for (let i = 0; i < 10; i++) {
// some code
}
// Here i is 5
The while loop [S1]
The while loop has the syntax while (condition) { // code block to be executed }.
while (i < 10) {
text += "The number is " + i;
i++;
}
Note: If you forget to increase the variable used in the condition, the loop will never end. This will crash your browser.
The do/while loop [S1]
The do/while loop has the syntax do { // code block to be executed } while (condition);.
do {
text += "The number is " + i;
i++;
}
while (i < 10);
Note: The do while runs at least once, even if the condition is false from the start.
Different kinds of loops [S1]
JavaScript supports the for loop (loops through a block of code a number of times), the for/in loop (loops through the properties of an object), the for/of loop (loops through the values of an iterable object), the while loop (loops through a block of code while a condition is true), and the do/while loop (also loops while a condition is true).
🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — replacing repeated text += cars[n] statements with a for loop over cars.length, and accumulating numbers in for/while/do-while loops. No external project/commit applications found in the source.
💻 코드 패턴 (Code patterns)
Iterate an array:
for (let i = 0; i < cars.length; i++) {
text += cars[i] + "<br>";
}
While loop with advancing counter:
while (i < 10) {
text += "The number is " + i;
i++;
}
Do-while (runs at least once):
do {
text += "The number is " + i;
i++;
}
while (i < 10);
⚖️ 비교 및 선택 기준 (Comparison & decision criteria)
forvswhile— useforwhen the number of iterations / the counter is known up front (init, condition, update in one place); usewhilewhen looping purely on a condition. [S1]whilevsdo/while— usedo/whilewhen the block must run at least once even if the condition is initially false. [S1]letvsvarfor the loop variable —letkeeps the counter scoped to the loop;varleaks it to the surrounding scope. [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 For Loop, JavaScript While Loop, JavaScript Break, JavaScript Booleans
- 참조 맥락: The overview entry point for all iteration constructs; specific loop types are detailed in their own pages.
📚 출처 (Sources)
- [S1] W3Schools — JavaScript Loops — https://www.w3schools.com/js/js_loops.asp
📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Loops" page (Astra wiki-curation, P-Reinforce v3.1 format).