Functions Returning other Functions:
Let's look into an example that illustrates how functions return other functions:

xxxxxxxxxx12
const names= ['John', 'Tina','Kale','Max']function returnFunction(arr) { return function secondFunction(y) { console.log("First argument is an array: "+ arr); console.log("Argument passed to second Function is "+ y ); };} const myFunc = returnFunction(names); myFunc("a string.");returnFunction(names)("a string.");OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment


