Documentation improvement: clarify function assignment behavior
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 72/100
- Issue 類型
- 文件
- 描述清晰度
- 基本清楚
- 活躍度
- 冷清
- 技術堆疊
- javascript
研究方向
開啟 https://javascript.info/function-expressions 中的 Function expressions 區段,找到「Function is a Value」主題及其指派範例。檢查「copy a function」周圍的措辭,並釐清指派的是對同一個函式物件的參照,同時維持範例的行為不變。當說明對學習者來說明確無歧義,且範例仍然正確時,即視為完成。
由索引模型根據 Issue 內容生成。
描述
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
- 主要語言
- HTML
- 星號
- 25.5k
- 分支
- 4k
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
javascript-tutorial/en.javascript.info 的其他 Issue
-
難度 1/5 1-3 小時 新手友好度 88/100
-
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 1/5 1 小時以內 新手友好度 92/100
-
Keyboard events: keydown filtering example can't block IME-composed input (Korean/Japanese/Chinese) 未關閉
難度 2/5 1-3 小時 新手友好度 76/100
javascript-tutorial/en.javascript.info#3978 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 74/100
查看 javascript-tutorial/en.javascript.info 的全部 Issue
相似的 Issue
-
user-reported
難度 2/5 1-3 小時 新手友好度 85/100
Kong/developer.konghq.com#7316 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
HarperFast/skills#96 ·
-
難度 2/5 1-3 小時 新手友好度 82/100
infinispan/infinispan#18150 ·
-
bug triage:deciding
難度 1/5 1 小時以內 新手友好度 88/100
open-telemetry/otel-arrow#4132 ·
-
Ecosystem: ClawMetry — the Qwen Code reader is now free and open source (follow-up to #9294 / #9338) 未關閉category/integration priority/P3 scope/documentation status/ready-for-human type/feature-request
難度 1/5 1 小時以內 新手友好度 84/100