javascript-tutorial / javascript-tutorial/zh.javascript.info

Promise 链 章节 补充表述的建议

Open
#1,218 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
HTML
Stars
10.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

位置:
https://zh.javascript.info/promise-chaining#shi-li-loadscript

问题:
1.没有说清楚:在最后一个then中(无论是第一种promise chain情况,还是第二种嵌套then的情况),为什么能访问one、two、three
2.没有说清楚:在promise chain中,最后一个then中不能访问每个script变量(我觉得,可能不对);嵌套then可以访问变量 script1,script2 和 script3,但诚如文章所说,这是个例外,而不是规则。

建议:
1.说明为什么能访问one two three函数:脚本被加载后,这些函数成为全局函数。promise chain保证的是它们加载完成再才被调用。
2.说明promise chain中,传递的script参数的作用(我觉得,文章例子中,script变量没有作用,不传没有影响)。

Contributor guide

No contributing guide indexed for this repository

Research direction

Open the Promise chaining section at the linked #shi-li-loadscript anchor and compare the promise-chain and nested-then examples. Clarify why the final then can access one, two, and three, explain which script variables are in scope, and state whether the passed script parameter affects the example; the section should explicitly distinguish loading order from variable scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.