javascript-tutorial / javascript-tutorial/en.javascript.info

Confusing use of "function declaration" in describing default parameters

未关闭
#3,509 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
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

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。