gpt4 book ai didi

javascript - 如何从函数内部调用函数?

转载 作者:行者123 更新时间:2023-11-28 11:14:05 25 4
gpt4 key购买 nike

如何将函数放入函数中?

do_something(){
alert('do something');
}

also_do_something = function(){
alert('also do something');
};

inp.onclick = function(){
do_something();

// this don't work
also_do_something;
};

最佳答案

要调用函数,必须添加括号:

inp.onclick = function(){
do_something();

also_do_something();
};

关于javascript - 如何从函数内部调用函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5780459/

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