开发者

question regarding execution sequence of function in javascript

开发者 https://www.devze.com 2022-12-25 04:49 出处:网络
hello friends my question is i am having two 开发者_如何学编程function f1 and f2 and if i want to execute function f2 after execution of f1 how is it possible?f1();

hello friends my question is i am having two 开发者_如何学编程function f1 and f2 and if i want to execute function f2 after execution of f1 how is it possible?


f1();
f2();

JavaScript is single-threaded, so code is executed linear-ly (is that a word?).


You will have to be a little bit more clear about that

You can have

function f2(){
}

function f1(){
   //do something
   f2();
}

or

function f2(){
}

function f1(){
}

function f3(){
   f1();
   f2();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号