Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 1.25 KB

_2703. Return Length of Arguments Passed.md

File metadata and controls

63 lines (47 loc) · 1.25 KB

All prompts are owned by LeetCode. To view the prompt, click the title link above.

Back to top


First completed : July 09, 2024

Last updated : July 09, 2024


Related Topics : N/A

Acceptance Rate : 94.41 %


Solutions

JavaScript

var argumentsLength = function(...args) {
    return arguments.length;
};
/**
 * @param {...(null|boolean|number|string|Array|Object)} args
 * @return {number}
 */
var argumentsLength = function(...args) {
    return args.length;
};

/**
 * argumentsLength(1, 2, 3); // 3
 */

TypeScript

type JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };

function argumentsLength(...args: JSONValue[]): number {
    return args.length;
};

/**
 * argumentsLength(1, 2, 3); // 3
 */