{ "data": { "question": { "questionId": "2809", "questionFrontendId": "2667", "boundTopicId": null, "title": "Create Hello World Function", "titleSlug": "create-hello-world-function", "content": "Write a function createHelloWorld. It should return a new function that always returns "Hello World".\n

 

\n

Example 1:

\n\n
\nInput: args = []\nOutput: "Hello World"\nExplanation:\nconst f = createHelloWorld();\nf(); // "Hello World"\n\nThe function returned by createHelloWorld should always return "Hello World".\n
\n\n

Example 2:

\n\n
\nInput: args = [{},null,42]\nOutput: "Hello World"\nExplanation:\nconst f = createHelloWorld();\nf({}, null, 42); // "Hello World"\n\nAny arguments could be passed to the function but it should still always return "Hello World".\n
\n\n

 

\n

Constraints:

\n\n\n", "translatedTitle": null, "translatedContent": null, "isPaidOnly": false, "difficulty": "Easy", "likes": 915, "dislikes": 128, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "[]\n[{},null,42]", "categoryTitle": "JavaScript", "contributors": [], "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\": \"202.6K\", \"totalSubmission\": \"253K\", \"totalAcceptedRaw\": 202629, \"totalSubmissionRaw\": 253036, \"acRate\": \"80.1%\"}", "hints": [], "solution": { "id": "1873", "canSeeDetail": true, "paidOnly": false, "hasVideoSolution": false, "paidOnlyVideo": true, "__typename": "ArticleNode" }, "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, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"javascript\": [\"JavaScript\", \"

Node.js 16.13.2.

\\r\\n\\r\\n

Your code is run with --harmony flag, enabling new ES6 features.

\\r\\n\\r\\n

lodash.js library is included by default.

\\r\\n\\r\\n

For Priority Queue / Queue data structures, you may use 5.3.0 version of datastructures-js/priority-queue and 4.2.1 version of datastructures-js/queue.

\"], \"typescript\": [\"Typescript\", \"

TypeScript 5.1.6, Node.js 16.13.2.

\\r\\n\\r\\n

Your code is run with --harmony flag, enabling new ES2022 features.

\\r\\n\\r\\n

lodash.js library is included by default.

\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }