javascript - Return a Function within a Function -


Here is an example of the code I am using:

  var Hello = Function Hi () {function by () {console.log (hi); Hello; }     Bye(); }; Hello();  

this is a link

I am trying to return the function bye to hi . As you can see, when I present the console.log (hi) value, my return statement does not return the high function. Hello

Code> function hi (message) {console.log (message)}

It takes a logic and shows it on the console

Now we have our bye function

  Function By () {Hi ("By Function Bye"); }  

No, when you call bye , you call hi at the same time

< Pre> bye (); // This console will be shown on the message "" called "" ...

If you want to return a function from a function, it is easy that you enter your Like function

  function Hi {message} {console.log (message)}  

and bye Function returns like hi function

  by function (by) {return Hi; }  

Now you need to do this, call it bye function and give it to show the logic returned in the console, such as

  by () ("This is a sample message");