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/originData/create-hello-world-function.json
2023-12-09 19:57:46 +08:00

59 lines
6.9 KiB
JSON
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.

{
"data": {
"question": {
"questionId": "2809",
"questionFrontendId": "2667",
"categoryTitle": "JavaScript",
"boundTopicId": 2255550,
"title": "Create Hello World Function",
"titleSlug": "create-hello-world-function",
"content": "Write a function&nbsp;<code>createHelloWorld</code>.&nbsp;It should return a new function that always returns&nbsp;<code>&quot;Hello World&quot;</code>.\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> args = []\n<strong>Output:</strong> &quot;Hello World&quot;\n<strong>Explanation:</strong>\nconst f = createHelloWorld();\nf(); // &quot;Hello World&quot;\n\nThe function returned by createHelloWorld should always return &quot;Hello World&quot;.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> args = [{},null,42]\n<strong>Output:</strong> &quot;Hello World&quot;\n<strong>Explanation:</strong>\nconst f = createHelloWorld();\nf({}, null, 42); // &quot;Hello World&quot;\n\nAny arguments could be passed to the function but it should still always return &quot;Hello World&quot;.\n</pre>\n\n<p>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>0 &lt;= args.length &lt;= 10</code></li>\n</ul>\n",
"translatedTitle": "创建 Hello World 函数",
"translatedContent": "请你编写一个名为 <code>createHelloWorld</code> 的函数。它应该返回一个新的函数,该函数总是返回 <code>\"Hello World\"</code>&nbsp;。\n<p>&nbsp;</p>\n\n<p><strong class=\"example\">示例 1</strong></p>\n\n<pre>\n<b>输入:</b>args = []\n<b>输出:</b>\"Hello World\"\n<strong>解释:</strong>\nconst f = createHelloWorld();\nf(); // \"Hello World\"\n\ncreateHelloWorld 返回的函数应始终返回 \"Hello World\"。\n</pre>\n\n<p><strong class=\"example\">示例 2</strong></p>\n\n<pre>\n<b>输入:</b>args = [{},null,42]\n<b>输出:</b>\"Hello World\"\n<strong>解释:</strong>\nconst f = createHelloWorld();\nf({}, null, 42); // \"Hello World\"\n\n可以传递任何参数给函数但它应始终返回 \"Hello World\"。\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>0 &lt;= args.length &lt;= 10</code></li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 8,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": true, \"java\": true, \"python\": true, \"python3\": true, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
"topicTags": [],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "JavaScript",
"langSlug": "javascript",
"code": "/**\n * @return {Function}\n */\nvar createHelloWorld = function() {\n \n return function(...args) {\n \n }\n};\n\n/**\n * const f = createHelloWorld();\n * f(); // \"Hello World\"\n */",
"__typename": "CodeSnippetNode"
},
{
"lang": "TypeScript",
"langSlug": "typescript",
"code": "function createHelloWorld() {\n \n\treturn function(...args): string {\n \n };\n};\n\n/**\n * const f = createHelloWorld();\n * f(); // \"Hello World\"\n */",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"12.8K\", \"totalSubmission\": \"15.2K\", \"totalAcceptedRaw\": 12819, \"totalSubmissionRaw\": 15164, \"acRate\": \"84.5%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "[]",
"metaData": "{\n \"name\": \"createHelloWorld\",\n \"params\": [\n {\n \"name\": \"args\",\n \"type\": \"string\"\n }\n ],\n \"return\": {\n \"type\": \"string\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "[]\n[{},null,42]",
"__typename": "QuestionNode"
}
}
}