Hacker News new | ask | show | jobs
by rgbrgb 4998 days ago
> Invoking a function suspends execution of the current function, passing controls and parameters to the invoked function.

False. JS functions execute asynchronously, without suspending the execution of the current function.

1 comments

Did I miss something here? Why was this downvoted?
Hi

I did not downvote your comment, but it is fundamentally incorrect. If your JavaScript program has been designed well, then asynchronisity by using an event driven model is the way to go. But that is very different to what I said about functions stopping the execution of the current function. This is true. For example

var func1 = function() { //Execute something here }

var func2 = function() { //Execute something here func1(); //Stop execution of this function, and rather execute func2 //Execute something here }

I hope the above explains this a bit better.