-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,alsotang,请教一个问题,谢谢 #161
Comments
你这个return是没法传递score1出来的,你要把你的return改成一个callback来传值给上层。 |
感谢大神回复,不过我上面没表达清楚意思哈,我不是想把最后return ({..})里面的score1传出来,而是想让superagent里面的score1 = $2('.unstyled .big').eq(0).text().trim();去修改superagent外面初始化的那个let score1=0, 让其不为0,而是等于从页面抓到的值,比如10,如果这样的话,最后return({})语句里面的那个score1也就为10了,而不是等于初始化的0,非常感谢!~ |
你去了解一下 callback逻辑的执行顺序。用console.log看看是return先执行还是callback里面的语句先执行
BeiMing <[email protected]> 于2018年10月8日周一 下午9:22写道:
… 你这个return是没法传递score1出来的,你要把你的return改成一个callback来传值给上层。
感谢大神回复,不过我上面没表达清楚意思哈,我不是想把最后return
({..})里面的score1传出来,而是想让superagent里面的score1 = $2('.unstyled
.big').eq(0).text().trim();去修改superagent外面初始化的那个let score1=0,
让其不为0,而是等于从页面抓到的值,比如10,如果这样的话,最后return({})语句里面的那个score1也就为10了,而不是等于初始化的0,非常感谢!~
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#161 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABGB7w7RoSqxUQYLn5oZ_3lkjoBvadpMks5ui1GTgaJpZM4XL6TT>
.
--
GitHub: https://github.com/alsotang
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我在做《Node.js 包教不包会》系列里面 lesson4的挑战题,取“积分”的时候,遇到一个难点,不知道怎样用superagent里面取到的变量取修改外面的全局变量,代码(部分)如下:
The text was updated successfully, but these errors were encountered: