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 »
function fn1() {};
function fn2(a, b, c) {};
// Get Function lenghts
let text = fn1.length + " " + fn2.length;
Syntax
function.length
Parameters
NONE
Return Value
Type
Description
Number
The number of parameters.
Function Methods & Properties
Browser Support
function.length is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera |