--- id: javascript-function-parameters title: "JavaScript Function Parameters" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["function parameters", "arguments", "parameters vs arguments", "default parameters", "parameter rules", "function input"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.87 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["javascript", "js", "web", "frontend", "w3schools", "functions", "parameters"] raw_sources: ["https://www.w3schools.com/js/js_function_parameters.asp"] applied_in: [] github_commit: "" --- # [[JavaScript Function Parameters]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Parameters are the named inputs a function declares in its parentheses; arguments are the real values passed in when it is called β€” and JavaScript checks neither their types nor their count. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Parameters pass values in** β€” parameters allow you to send values to a function and are listed inside the parentheses in the function definition. [S1] - **Parameters vs arguments** β€” parameters are the names listed in the function definition; arguments are the real values passed to and received by the function. [S1] - **No type or count enforcement** β€” JavaScript function definitions do not specify data types for parameters, do not perform type checking on arguments, and do not check the number of arguments received. [S1] - **Missing arguments give wrong results** β€” accessing a function with an incorrect (missing) parameter can return an incorrect answer. [S1] - **Default parameter values** β€” ECMAScript 2015 allows function parameters to have default values, used when no argument is provided. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **One or many parameters** β€” declare a single parameter, or as many as needed separated by commas. [S1] - **Default fallback** β€” `function f(x, y = 10)` supplies `10` when the second argument is omitted. [S1] - **No safety net** β€” because there is no type/count checking, a missing argument silently flows through (e.g. `toCelsius()` with no input). [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **Parameters (Function Input)** β€” parameters allow you to pass (send) values to a function; they are listed inside the parentheses in the function definition. [S1] **Functions with One Parameter** β€” a function can have one parameter: [S1] ```javascript function sayHello(name) { return "Hello " + name; } let greeting = sayHello("John"); ``` A single-parameter conversion: [S1] ```javascript function toCelsius(fahrenheit) { return (5 / 9) * (fahrenheit - 32); } let value = toCelsius(77); ``` **Functions with Multiple Parameters** β€” you can add as many parameters as you want, separated by commas: [S1] ```javascript function multiply(a, b) { return a * b; } let result = multiply(4, 5); ``` ```javascript function fullName(firstName, lastName) { return firstName + " " + lastName; } let name = fullName("John", "Doe"); ``` **Parameters vs. Arguments** β€” parameters are the names listed in the function definition; arguments are the real values passed to and received by the function. [S1] **Parameter Rules** β€” JavaScript function definitions do not specify data types for parameters; JavaScript functions do not perform type checking on the arguments; JavaScript functions do not check the number of arguments received. [S1] **Incorrect Parameters** β€” accessing a function with an incorrect (missing) parameter can return an incorrect answer: [S1] ```javascript function toCelsius(fahrenheit) { return (5/9) * (fahrenheit-32); } let value = toCelsius(); ``` **Default Parameter Values** β€” ECMAScript 2015 allows function parameters to have default values; the default value is used if no argument is provided: [S1] ```javascript function myFunction(x, y = 10) { return x + y; } myFunction(5); ``` ## πŸ› οΈ 적용 사둀 (Applied in summary) The page's own snippets are the canonical applied examples β€” single-parameter `sayHello(name)` and `toCelsius(fahrenheit)`, multi-parameter `multiply(a, b)` and `fullName(firstName, lastName)`, the missing-argument `toCelsius()` case, and the default-parameter `myFunction(x, y = 10)`. No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Multiple parameters (language: JavaScript): ```javascript function fullName(firstName, lastName) { return firstName + " " + lastName; } let name = fullName("John", "Doe"); ``` Default parameter value: ```javascript function myFunction(x, y = 10) { return x + y; } myFunction(5); ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (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 Functions]], [[JavaScript Function Definitions]], [[JavaScript Function Invocation]], [[JavaScript Function Returns]] - **μ°Έμ‘° λ§₯락:** Referenced when designing a function's inputs, defaults, and how callers supply arguments. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” JavaScript Function Parameters β€” https://www.w3schools.com/js/js_function_parameters.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "JavaScript Function Parameters" page (Astra wiki-curation, P-Reinforce v3.1 format).