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)/返回传递的参数的长度 [return-length-of-arguments-passed].html

34 lines
780 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>argumentsLength</code>,返回传递给该函数的参数数量。
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<pre>
<b>输入:</b>args = [5]
<b>输出:</b>1
<strong>解释:</strong>
argumentsLength(5); // 1
只传递了一个值给函数,因此它应返回 1。
</pre>
<p><strong class="example">示例 2</strong></p>
<pre>
<b>输入:</b>args = [{}, null, "3"]
<b>输出:</b>3
<b>解释:</b>
argumentsLength({}, null, "3"); // 3
传递了三个值给函数,因此它应返回 3。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>args</code>&nbsp;是一个有效的 JSON 数组</li>
<li><code>0 &lt;= args.length &lt;= 100</code></li>
</ul>