javascript-tutorial / javascript-tutorial/en.javascript.info
Confusing use of "function declaration" in describing default parameters
- 主要語言
- HTML
- 星號
- 25.5k
- 分支
- 4k
- PR 合併指標
- 30 天內沒有已合併 PR
描述
> **[Alternative default parameters](https://javascript.info/function-basics#alternative-default-parameters)**
> Sometimes it makes sense to assign default values for parameters at a later stage after the function declaration.
> ...
> ```js run
> function showMessage(text) {
> // ...
>
> if (text === undefined) { // if the parameter is missing
> text = 'empty message';
> }
>
> alert(text);
> }
>
> showMessage(); // empty message
> ```
The declaration includes the function definition. Saying "after the function declaration" suggests something happening after the entirety of the function when the description refers to something happening later in the body.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
開啟連結的 Alternative default parameters 區段,檢視範例周圍的措辭。修改對 "function declaration" 的引用,使其準確描述函式本體內後續的指定,然後檢查周圍的說明是否仍然清楚。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- documentation
- Issue 類型
- 文件
- 難度
- 1/5
- 預估耗時
- 1 小時以內
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100