web-dev-qa-db-fra.com

Comment appeler une fonction dans une autre fonction?

Je veux juste savoir comment appeler une fonction javascript dans une autre fonction. Donc, si j'ai le code ci-dessous, comment appeler la deuxième fonction dans la première?

function function_one()
{
alert("The function called 'function_one' has been called.")
//Here I would like to call function_two.
}

function function_two()
{
alert("The function called 'function_two' has been called.")
}
58
Web_Designer
function function_one() {
    function_two(); // considering the next alert, I figured you wanted to call function_two first
    alert("The function called 'function_one' has been called.");
}

function function_two() {
    alert("The function called 'function_two' has been called.");
}

function_one();
94
Christian
function function_one() {
  function_two(); 
}

function function_two() {
//enter code here
}
21
Luthoz
function function_one()
{
    alert("The function called 'function_one' has been called.")
    //Here u would like to call function_two.
    function_two(); 
}

function function_two()
{
    alert("The function called 'function_two' has been called.")
}
4
Rajendra Tripathy