mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
32 lines
854 B
HTML
32 lines
854 B
HTML
Write a function <code>argumentsLength</code> that returns the count of arguments passed to it.
|
|
<p> </p>
|
|
<p><strong class="example">Example 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> args = [5]
|
|
<strong>Output:</strong> 1
|
|
<strong>Explanation:</strong>
|
|
argumentsLength(5); // 1
|
|
|
|
One value was passed to the function so it should return 1.
|
|
</pre>
|
|
|
|
<p><strong class="example">Example 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>Input:</strong> args = [{}, null, "3"]
|
|
<strong>Output:</strong> 3
|
|
<strong>Explanation:</strong>
|
|
argumentsLength({}, null, "3"); // 3
|
|
|
|
Three values were passed to the function so it should return 3.
|
|
</pre>
|
|
|
|
<p> </p>
|
|
<p><strong>Constraints:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>args</code> is a valid JSON array</li>
|
|
<li><code>0 <= args.length <= 100</code></li>
|
|
</ul>
|