Javascript Functioncall(arg1)(arg2)
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 googl
You could do:
functionsay(firstword){
returnfunction(secondword){
return firstword + " " + secondword;
}
}
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?
Post a Comment for "Javascript Functioncall(arg1)(arg2)"