Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

createHelloWorld "Hello World"

 

Example 1:

Input: args = []
Output: "Hello World"
Explanation:
const f = createHelloWorld();
f(); // "Hello World"

The function returned by createHelloWorld should always return "Hello World".

Example 2:

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".

 

Constraints:

  • 0 <= args.length <= 10

Companies: Google, Amazon

Solution 1.

// OJ: https://leetcode.com/problems/create-hello-world-function
// Author: github.com/lzl124631x
// Time: O(1)
// Space: O(1)
var createHelloWorld = function() {
    return function(...args) {
        return "Hello World";
    }
};