LeetCode solutions

2809. Create Hello World Function

My accepted JavaScript solution to LeetCode problem 2809, Create Hello World Function, running in 46ms.

  • Difficulty: Easy
  • JavaScript
  • Runtime 46ms
  • Memory 53.2MB

Read the problem on LeetCode View on GitHub

JavaScript

Accepted on LeetCode — runtime 46ms, memory 53.2MB, accepted 2025-12-31.

javascript
/**
 * @return {Function}
 */
var createHelloWorld = function() {
    return function(...args) {
        return "Hello World";
    }
};

/**
 * const f = createHelloWorld();
 * f(); // "Hello World"
 */

Source