0

If I have an event that runs multiple javascripts does the following script wait until the previous script is complete before it runs?

Example:

<a href="#" onclick="javascript:SCRIPT_1();SCRIPT_2();SCRIPT_3();">Test Me</a>

Will SCRIPT_2 not execute until SCRIPT_1 is complete doing its stuff?

Thanks.

2 Answers 2

6

AFAIK, yes, javascript execution is synchronous. So, SCRIPT_2 will not execute untill SCRIPT_1 is done.

edit Yep, the accepted answer on when-is-javascript-synchronous is worth a read

Sign up to request clarification or add additional context in comments.

Comments

2

That is correct. Javascript is executed synchronously so SCRIPT_1 will complete before SCRIPT_2 begins (at least when defined like you have).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.