#2667
Easy JavaScript Create hello world function
82.0% acceptance
Mar 2, 2026
1641
228
Write a function createHelloWorld. It should return a new function that always returns "Hello World".
Solution
TypeScript
Time O(1)
Space O(1)
function createHelloWorld() {
return function (...args: any[]): string {
return "Hello World";
};
}
/**
* const f = createHelloWorld();
* f(); // "Hello World"
*/