Function length Property
Description
The length property returns the number of function parameters.
Example
// Create Functions
function fn1() {};
function fn2(a, b, c) {};
// Get Function lenghts
let text = fn1.length + " " + fn2.length;
Try it Yourself »
Syntax
function.length
Parameters
| NONE |
Return Value
| Type | Description |
| Number | The number of parameters. |
JavaScript Function Methods
Browser Support
function.length is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera |