Calling a Function defined inside another function in Javascript

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

I am calling a function on button click like this:

​

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


        
6条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 14:00

    you can also just use return:

       function outer() { 
        function inner() {
            alert("hi");
        }
    return inner();
    
    }
    outer();
    

提交回复
热议问题