Overview
Implement functionLength(fn) that returns the number of formal parameters.
Examples
functionLength(function(a, b, c) {}); // 3
functionLength(function() {}); // 0Solution
Reveal solution
function functionLength(fn) {
return fn.length;
}function-length.js
Function Length
easycodingJavaScriptFunctions
Overview
Implement functionLength(fn) that returns the number of formal parameters.
Examples
functionLength(function(a, b, c) {}); // 3
functionLength(function() {}); // 0Solution
Reveal solution
function functionLength(fn) {
return fn.length;
}NameTopicDifficulty
103 of 103 problems