2667. Create Hello World Function
UnknownView on LeetCode
Advertisement
About this solution
Create Hello World Function is a unknown-difficulty LeetCode problem covering the JavaScript pattern. The TypeScript solution below uses an idiomatic approach that is clean, readable, and directly submittable on LeetCode. Study the logic carefully — recognising the underlying pattern is the key skill that transfers to similar problems in interviews.
Key Techniques
2667.ts
TypeScript
function createHelloWorld() {
return function (...args): string {
return "Hello World";
};
}
/**
* const f = createHelloWorld();
* f(); // "Hello World"
*/
Advertisement
Was this solution helpful?