[LeetCode] Create Hello World Function

2667. Create Hello World Function

Write a function createHelloWorld. It should return a new function that always returns "Hello World".

1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
* @return {Function}
*/
var createHelloWorld = function() {

return function(...args) {
return "Hello World";
}
};

/**
* const f = createHelloWorld();
* f(); // "Hello World"
*/
Author: Song Hayoung
Link: https://songhayoung.github.io/2024/03/25/PS/LeetCode/create-hello-world-function/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.