docs(10_Wiki): Dev 폴더 누락분 반영 — Topic_Programming으로 통합

이전 재구성 작업에서 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.
This commit is contained in:
Antigravity Agent
2026-07-05 00:39:13 +09:00
parent 9148c358d0
commit e9cbf23ab5
1356 changed files with 0 additions and 12831 deletions
@@ -0,0 +1,152 @@
---
id: javascript-function-definitions
title: "JavaScript Function Definitions"
category: "Frontend"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["function definitions", "function declaration", "function syntax", "defining functions", "local variables", "function intro"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.86
created_at: 2026-06-23
updated_at: 2026-06-23
review_reason: ""
merge_history: []
tags: ["javascript", "js", "web", "frontend", "w3schools", "functions", "definitions"]
raw_sources: ["https://www.w3schools.com/js/js_function_intro.asp"]
applied_in: []
github_commit: ""
---
# [[JavaScript Function Definitions]]
## 🎯 한 줄 통찰 (One-line insight)
A function is defined with the `function` keyword, a name, a parenthesized parameter list, and a body — once defined it is a reusable block that runs only when called. [S1]
## 🧠 핵심 개념 (Core concepts)
- **Functions are code blocks** — reusable code designed to perform a particular task; they execute when called or invoked. [S1]
- **Definition syntax** — `function name(p1, p2, ...) { ... }`: keyword, name, comma-separated parameters in parentheses, body in braces. [S1]
- **Why define functions** — to reuse code (write once, run many times) and organize code into manageable sections. [S1]
- **Run on call** — the body does not run at definition time; it runs when the function is invoked. [S1]
- **Local variables** — variables declared inside a function are accessible only within it, created when the function starts and deleted when it completes. [S1]
- **Functions as variable values** — a function call can be used wherever a value is expected. [S1]
## 🧩 추출된 패턴 (Extracted patterns)
- **Name → parameters → body** — the standard declaration shape that makes a block callable by name. [S1]
- **Parameterized reuse** — define once with parameters, call repeatedly with different arguments. [S1]
- **Scope by definition** — placing a `let` inside the function body confines it to that function. [S1]
## 📖 세부 내용 (Details)
**Functions are Code Blocks** — functions are reusable code blocks designed to perform a particular task; they execute when they are called or invoked. [S1]
**Why Use Functions?** — functions let you reuse code (write once, run many times) and organize code into manageable sections. [S1]
**JavaScript Function Syntax** — a function is defined with the `function` keyword, a name, parameters in parentheses, and a body in curly braces: [S1]
```javascript
function name( p1, p2, ... ) {
// code to be executed
}
```
**What Does a Function Look Like?** — a basic definition: [S1]
```javascript
function sayHello() {
return "Hello World";
}
```
**Functions Run When You Call Them** — the defined function runs only when invoked, and the returned value can be stored: [S1]
```javascript
function sayHello() {
return "Hello World";
}
let message = sayHello();
```
A definition with parameters: [S1]
```javascript
function multiply(a, b) {
return a * b;
}
```
**A Function Can Be Used Many Times** — the same definition is reused with different arguments: [S1]
```javascript
function add(a, b) {
return a + b;
}
let sum1 = add(5, 5);
let sum2 = add(50, 50);
```
**Local Variables** — variables declared inside a function can only be accessed from within the function; they are created when the function starts and deleted when it completes: [S1]
```javascript
// code here can NOT use carName
function myFunction() {
let carName = "Volvo";
// code here CAN use carName
}
// code here can NOT use carName
```
**Functions Used as Variables** — a function call can be used directly inside an expression: [S1]
```javascript
let x = toCelsius(77);
let text = "The temperature is " + x + " Celsius";
```
And inlined directly: [S1]
```javascript
let text = "The temperature is " + toCelsius(77) + " Celsius";
```
## 🛠️ 적용 사례 (Applied in summary)
The page's own snippets are the canonical applied examples — defining `sayHello()`, `multiply(a, b)`, the reusable `add(a, b)`, the scoped `myFunction()`, and using `toCelsius(77)` as a value. No external project/commit applications found in the source.
## 💻 코드 패턴 (Code patterns)
Define a function (language: JavaScript):
```javascript
function name( p1, p2, ... ) {
// code to be executed
}
```
Define and reuse with parameters:
```javascript
function add(a, b) {
return a + b;
}
let sum1 = add(5, 5);
let sum2 = add(50, 50);
```
Confine a variable to a function:
```javascript
function myFunction() {
let carName = "Volvo";
}
```
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
No contradictions found in the source.
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual (실제 적용 사례 발견 시 applied/validated로 승격 가능)
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.86
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[JavaScript Tutorial]]
- **관련 개념:** [[JavaScript Functions]], [[JavaScript Function Invocation]], [[JavaScript Function Parameters]], [[JavaScript Function Returns]]
- **참조 맥락:** Referenced when learning how to declare and scope a reusable callable block.
## 📚 출처 (Sources)
- [S1] W3Schools — JavaScript Function Definitions — https://www.w3schools.com/js/js_function_intro.asp
## 📝 변경 이력 (Change history)
- 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Function Definitions" page (Astra wiki-curation, P-Reinforce v3.1 format).