mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
32 lines
861 B
HTML
32 lines
861 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> argsArr = [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> argsArr = [{}, 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>argsArr is a valid JSON array</code></li>
|
|
<li><code>0 <= argsArr.length <= 100</code></li>
|
|
</ul>
|