Working with JS may be difficult for a beginner. Or for someone like me, who dares to think of himself as a … let’s call it not a beginner. 🙂
One of the strangest staff there, if you are coming from the VBA world (like me) is the option of a function to return a function, returning a function (and you may return functions in functions as much as you want).
Let’s see how this happens. In the sample, we create a function “outer”, returning a function, returning another one. Each one of the functions writes on the console, so you may see how deep have we gone inside. The trick in going deeper into the functions is to use the parenthesis.
This is the result:
Here comes the code, enjoy it:
console.log("Now with three:");
console.log("Now with two:");
console.log("Now with one:");