javascript-tutorial / javascript-tutorial/en.javascript.info
Documentation improvement: clarify function assignment behavior
まだ誰も着手していません。
- 主要言語
- HTML
- スター
- 25.5k
- フォーク
- 4k
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I was reading the Function expressions section and noticed a wording choice that confused me a little.
The section mentions that we can "copy a function to another variable". Maybe the intention is to show that functions are values in JavaScript, the wording initially made me think that a new function was being created.
**issue in the section -> url -> https://javascript.info/function-expressions
topic is "Function is a Value"**
the example code was ->
function sayHi() { // (1) create
alert( "Hello" );
}
let func = sayHi; // (2) copy
func(); // Hello // (3) run the copy (it works)!
sayHi(); // Hello // this still works too (why wouldn't it)
My understanding is that func receives a reference to the same function object rather than creating an independent copy of the function itself.
There maybe a chance that i have misunderstood it , the copy could mean the reference is copied and a little context about reference would help even if it is included in the previous section.
This is not a major issue, but I thought a small clarification might help readers who are learning about values and references.
Thank you so much for the documentation
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
https://javascript.info/function-expressions の Function expressions セクションを開き、「Function is a Value」トピックとその代入例を見つけてください。「copy a function」に関する表現を確認し、同じ関数オブジェクトへの参照が代入されることを明確にしつつ、例の動作を維持してください。学習者にとって説明が曖昧でなく、例が引き続き正しい状態になれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- documentation
- issue の種類
- ドキュメント
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 72/100