Function.getArgumentNames >= 0.3.8

Purpose

Get the name of a function's arguments

Syntax

Function.getArgumentNames ( Functionfnc );

Parameters

fnc

Return values

Array

An array of names

Examples

Get the argument names from a regular function

function myFnc(alpha, beta) {
    return 1;
}

Function.getArgumentNames(myFnc);
>>> ["alpha", "beta"]

Get the argument names from a function with default values

function myFnc(alpha = 1, beta) {
    return 1;
}

// The result is the same as the previous example
Function.getArgumentNames(myFnc);
>>> ["alpha", "beta"]

Comments