I am studying JavaScript and I can't understand this.
function Out1()
{
function In1()
{
console.log("text inside function In1");
}
return In1();
}
function Out2()
{
return function In2()
{
console.log("text inside function In2");
};
}
Out1(); // text inside function In1
Out2(); //
Out2(); outputs nothing in console. What I am doing wrong?
Out2returns an anonymous function which needs execution to produce your expected output.Out2()()would do that.