{
"data": {
"question": {
"questionId": "2820",
"questionFrontendId": "2703",
"categoryTitle": "JavaScript",
"boundTopicId": 2285880,
"title": "Return Length of Arguments Passed",
"titleSlug": "return-length-of-arguments-passed",
"content": "Write a function argumentsLength
that returns the count of arguments passed to it.\n
\n
Example 1:
\n\n\nInput: args = [5]\nOutput: 1\nExplanation:\nargumentsLength(5); // 1\n\nOne value was passed to the function so it should return 1.\n\n\n
Example 2:
\n\n\nInput: args = [{}, null, "3"]\nOutput: 3\nExplanation: \nargumentsLength({}, null, "3"); // 3\n\nThree values were passed to the function so it should return 3.\n\n\n
\n
Constraints:
\n\nargs
is a valid JSON array0 <= args.length <= 100
argumentsLength
,返回传递给该函数的参数数量。\n\n\n
示例 1:
\n\n\n输入:args = [5]\n输出:1\n解释:\nargumentsLength(5); // 1\n\n只传递了一个值给函数,因此它应返回 1。\n\n\n
示例 2:
\n\n\n输入:args = [{}, null, \"3\"]\n输出:3\n解释:\nargumentsLength({}, null, \"3\"); // 3\n\n传递了三个值给函数,因此它应返回 3。\n\n\n
\n\n
提示:
\n\nargs
是一个有效的 JSON 数组0 <= args.length <= 100
\\u7248\\u672c\\uff1a \\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n \\u60a8\\u53ef\\u4f7f\\u7528 datastructures-js <\\/a>\\u5e93\\u6240\\u63d0\\u4f9b\\u7684\\u6570\\u636e\\u7ed3\\u6784\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\" TypeScript 5.7.3<\\/p>\\r\\n\\r\\n Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2024<\\/p>\\r\\n\\r\\n lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\nNode.js 22.14.0<\\/code><\\/p>\\r\\n\\r\\n
--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f \\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n