1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/创建 Hello World 函数 [create-hello-world-function].html
2023-05-15 17:43:00 +08:00

35 lines
891 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

请你编写一个名为 <code>createHelloWorld</code> 的函数。它应该返回一个新的函数,该函数总是返回 <code>"Hello World"</code>&nbsp;
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<b>输入:</b>args = []
<b>输出:</b>"Hello World"
<strong>解释:</strong>
const f = createHelloWorld();
f(); // "Hello World"
createHelloWorld 返回的函数应始终返回 "Hello World"。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<b>输入:</b>args = [{},null,42]
<b>输出:</b>"Hello World"
<strong>解释:</strong>
const f = createHelloWorld();
f({}, null, 42); // "Hello World"
可以传递任何参数给函数,但它应始终返回 "Hello World"。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= args.length &lt;= 10</code></li>
</ul>