gpt4 book ai didi

javascript - 回调函数说明

转载 作者:行者123 更新时间:2023-12-03 16:29:40 25 4
gpt4 key购买 nike

我有一个像这样的 javascript 回调函数设置

function myFunction(callback){

$('meta[name="viewport"]').prop('content', 'width=1440');
//other code
callback()
}

function otherFunction(){
//some async operation
}

myFunction(otherFunction)

此代码是否确保我的 otherFunction 在视口(viewport)更改和上面的其他代码实现之前不运行?

最佳答案

如果 callback 调用上面的所有代码都是同步的,那么是的,otherFunction 将在上面所有代码之后运行。

关于javascript - 回调函数说明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52330910/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com