2667. 创建 Hello World 函数 - 闭包

Smile_slime_47

Problem: 2667. 创建 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"
*/
1
2
3
4
5
6
7
8
9
/**
* @return {Function}
*/
var createHelloWorld = () => (...args) => "Hello World"

/**
* const f = createHelloWorld();
* f(); // "Hello World"
*/
Comments
On this page
2667. 创建 Hello World 函数 - 闭包