Javascript Functioncall(arg1)(arg2) June 28, 2023 Post a Comment 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 googlSolution 1: You could do:functionsay(firstword){ returnfunction(secondword){ return firstword + " " + secondword; } } Copyhttp://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? Share Post a Comment for "Javascript Functioncall(arg1)(arg2)"
Post a Comment for "Javascript Functioncall(arg1)(arg2)"