Function calling in Javascript with double brackets

后端 未结 5 586
小蘑菇
小蘑菇 2021-02-06 13:23

When I call function hi()() with double brackets the function displays hi output and it will also give error saying, that hi is not functi

5条回答
  •  没有蜡笔的小新
    2021-02-06 13:57

    The double parenthesis would have been useful if hi had returned a function instead of its name, like in

    function hi(){
        return hello;
    }
    hi()();
    

    That's probably what was the intent.

提交回复
热议问题