2023-06-02 01:00:40 +08:00
{
"data" : {
"question" : {
"questionId" : "2820" ,
"questionFrontendId" : "2703" ,
"categoryTitle" : "JavaScript" ,
"boundTopicId" : 2285880 ,
"title" : "Return Length of Arguments Passed" ,
"titleSlug" : "return-length-of-arguments-passed" ,
2023-12-09 18:42:21 +08:00
"content" : "Write a function <code>argumentsLength</code> that returns the count of arguments passed to it.\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> args = [5]\n<strong>Output:</strong> 1\n<strong>Explanation:</strong>\nargumentsLength(5); // 1\n\nOne value was passed to the function so it should return 1.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> args = [{}, null, "3"]\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> \nargumentsLength({}, null, "3"); // 3\n\nThree values were passed to the function so it should return 3.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>args</code> is a valid JSON array</li>\n\t<li><code>0 <= args.length <= 100</code></li>\n</ul>\n" ,
2023-06-02 01:00:40 +08:00
"translatedTitle" : "返回传递的参数的长度" ,
2023-12-09 18:42:21 +08:00
"translatedContent" : "请你编写一个函数 <code>argumentsLength</code>,返回传递给该函数的参数数量。\n<p> </p>\n\n<p><strong class=\"example\">示例 1: </strong></p>\n\n<pre>\n<b>输入:</b>args = [5]\n<b>输出:</b>1\n<strong>解释:</strong>\nargumentsLength(5); // 1\n\n只传递了一个值给函数, 因此它应返回 1。\n</pre>\n\n<p><strong class=\"example\">示例 2: </strong></p>\n\n<pre>\n<b>输入:</b>args = [{}, null, \"3\"]\n<b>输出:</b>3\n<b>解释:</b>\nargumentsLength({}, null, \"3\"); // 3\n\n传递了三个值给函数, 因此它应返回 3。\n</pre>\n\n<p> </p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>args</code> 是一个有效的 JSON 数组</li>\n\t<li><code>0 <= args.length <= 100</code></li>\n</ul>\n" ,
2023-06-02 01:00:40 +08:00
"isPaidOnly" : false ,
"difficulty" : "Easy" ,
2023-12-09 18:42:21 +08:00
"likes" : 3 ,
2023-06-02 01:00:40 +08:00
"dislikes" : 0 ,
"isLiked" : null ,
"similarQuestions" : "[]" ,
"contributors" : [ ] ,
2023-12-09 18:42:21 +08:00
"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}" ,
2023-06-02 01:00:40 +08:00
"topicTags" : [ ] ,
"companyTagStats" : null ,
"codeSnippets" : [
{
"lang" : "JavaScript" ,
"langSlug" : "javascript" ,
2023-12-09 18:42:21 +08:00
"code" : "/**\n * @param {...(null|boolean|number|string|Array|Object)} args\n * @return {number}\n */\nvar argumentsLength = function(...args) {\n\t\n};\n\n/**\n * argumentsLength(1, 2, 3); // 3\n */" ,
2023-06-02 01:00:40 +08:00
"__typename" : "CodeSnippetNode"
} ,
{
"lang" : "TypeScript" ,
"langSlug" : "typescript" ,
2023-12-09 18:42:21 +08:00
"code" : "type JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };\n\nfunction argumentsLength(...args: JSONValue[]): number {\n\t\n};\n\n/**\n * argumentsLength(1, 2, 3); // 3\n */" ,
2023-06-02 01:00:40 +08:00
"__typename" : "CodeSnippetNode"
}
] ,
2023-12-09 18:42:21 +08:00
"stats" : "{\"totalAccepted\": \"6.4K\", \"totalSubmission\": \"6.9K\", \"totalAcceptedRaw\": 6416, \"totalSubmissionRaw\": 6906, \"acRate\": \"92.9%\"}" ,
2023-06-02 01:00:40 +08:00
"hints" : [ ] ,
"solution" : null ,
"status" : null ,
"sampleTestCase" : "[5]" ,
2023-12-09 18:42:21 +08:00
"metaData" : "{\n \"name\": \"argumentsLength\",\n \"params\": [\n {\n \"type\": \"string\",\n \"name\": \"args\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}" ,
2023-06-02 01:00:40 +08:00
"judgerAvailable" : true ,
"judgeType" : "large" ,
"mysqlSchemas" : [ ] ,
"enableRunCode" : true ,
2023-12-09 18:42:21 +08:00
"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>\"]}" ,
2023-06-02 01:00:40 +08:00
"book" : null ,
"isSubscribed" : false ,
"isDailyQuestion" : false ,
"dailyRecordStatus" : null ,
"editorType" : "CKEDITOR" ,
"ugcQuestionId" : null ,
"style" : "LEETCODE" ,
"exampleTestcases" : "[5]\n[{},null,\"3\"]" ,
"__typename" : "QuestionNode"
}
}
}