Calling a Function defined inside another function in Javascript

前端 未结 6 551
醉酒成梦
醉酒成梦 2020-12-02 13:12

I am calling a function on button click like this:

​

function outer() { 
    alert(\"hi\"         


        
6条回答
  •  日久生厌
    2020-12-02 13:39

    You are not calling the function inner, just defining it.

    function outer() { 
        function inner() {
            alert("hi");
        }
    
        inner(); //Call the inner function
    
    }
    

提交回复
热议问题