문제

Write a function argumentsLength that returns the count of arguments passed to it.

https://leetcode.com/problems/return-length-of-arguments-passed/

 

예시

 

코드

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

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

 

인자의 개수를 리턴하면 된다.

728x90

+ Recent posts