run function one by one in javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • perhapscwk
    New Member
    • Sep 2007
    • 123

    run function one by one in javascript

    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?

    Code:
     
    Function run() {
     
    function startA();
    function startB();
     
    }
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Rather than declaring functions, call them:
    Code:
    function run() {
        startA();
        startB();
    }

    Comment

    • perhapscwk
      New Member
      • Sep 2007
      • 123

      #3
      yes..but but both startA and startB process at the same time..

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Can you post the code or at least explain what they do.

        Comment

        • perhapscwk
          New Member
          • Sep 2007
          • 123

          #5
          startA will return a value.

          then StartB use it to process.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

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

            Comment

            Working...