Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Post Timeline

Commonmark migration
Source Link

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can find another example

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can find another example

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can find another example

added 5 characters in body
Source Link
BeNdErR
  • 18k
  • 21
  • 79
  • 107

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can find another example

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can another example

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can find another example

added 113 characters in body
Source Link
BeNdErR
  • 18k
  • 21
  • 79
  • 107

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can another example

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

It depends on what you have inside your first() and second() functions.. if you have some async calls, first() may end after second().

For example

function first(){
 console.log("I'm first"); 
}
function second(){
 console.log("I'm second"); 
}
first();
second();

will print

I'm first

I'm second

Now suppose you have an ajax call in your first() function that takes 10 seconds to end:

function first(){
 $.ajax({
 //--- blah blah
 success: function(){
 //--- success runs after 10 seconds
 console.log("I'm first"); 
 }
 })
}

if you run

first();
second();

you will have printed

I'm second

I'm first

Here you can another example

Source Link
BeNdErR
  • 18k
  • 21
  • 79
  • 107
Loading
lang-js

AltStyle によって変換されたページ (->オリジナル) /