Input: args =[]Output: "Hello World"Explanation:
const f = createHelloWorld();f();// "Hello World"
The function returned by createHelloWorld should always return"Hello World".
Input: args =[{},null,42]Output: "Hello World"Explanation:
const f = createHelloWorld();f({},null,42);// "Hello World"
Any arguments could be passed to the function but it should still always return"Hello World".
The key idea is to use a closure that ignores its arguments and always returns the string “Hello World”. This leverages JavaScript/TypeScript’s ability to return a function from another function, capturing the desired behavior.