program story

다른 함수 내에서 함수를 어떻게 호출합니까?

inputbox 2020. 12. 4. 08:10
반응형

다른 함수 내에서 함수를 어떻게 호출합니까?


다른 함수 내에서 자바 스크립트 함수를 호출하는 방법을 알고 싶습니다. 그래서 아래 코드가 있다면 첫 번째 함수 안에서 두 번째 함수를 어떻게 호출합니까?

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.")
}

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();


function function_one() {
  function_two(); 
}

function function_two() {
//enter code here
}

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.")
}

참고 URL : https://stackoverflow.com/questions/4524877/how-do-i-call-a-function-inside-of-another-function

반응형