I'm learning JavaScript and I found this example
say("Hello")("World");
This code should return "Hello World".
I don't know how to implement this even what keyword type to google to find soulution. Can you advice me please what is name of this pattern or how it is possible to implement it in JavaScript?
You could do:
http://jsfiddle.net/o5o0f511/
You would never do this in practice though. I'm sure this is just to teach you how functions can return executable functions.
There's some more examples of this pattern here:
How do JavaScript closures work?
Possibly you can try closures:
Here, when
say("Hello")
is invoked it returns the inner block. The later call with("World")
invokes the inner block returning the concatenated string "Hello World"