Connecting Tech Pros Worldwide Help | Site Map

run function one by one in javascript

Member
 
Join Date: Sep 2007
Posts: 77
#1: Jan 16 '09
I have a function similar as below, when function run() is calling,
it will run startA and startB at the same time, how to make
sure startB will run only after startA completed?

Expand|Select|Wrap|Line Numbers
  1.  
  2. Function run() {
  3.  
  4. function startA();
  5. function startB();
  6.  
  7. }
  8.  
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Jan 16 '09

re: run function one by one in javascript


Rather than declaring functions, call them:
Expand|Select|Wrap|Line Numbers
  1. function run() {
  2.     startA();
  3.     startB();
  4. }
Member
 
Join Date: Sep 2007
Posts: 77
#3: Jan 16 '09

re: run function one by one in javascript


yes..but but both startA and startB process at the same time..
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Jan 16 '09

re: run function one by one in javascript


Can you post the code or at least explain what they do.
Member
 
Join Date: Sep 2007
Posts: 77
#5: Jan 16 '09

re: run function one by one in javascript


startA will return a value.

then StartB use it to process.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: Jan 16 '09

re: run function one by one in javascript


Can you post the code or (if it's too long) a link.
Reply