Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript function length

// The "function length" in JS evaluates to the number of it's params

const sum = (a, b) => a + b;
const log = (s) => console.log(s);
const noop = () => {};

console.log(sum.length);  // 2
console.log(log.length);  // 1
console.log(noop.length); // 0
Source by learn.coderslang.com #
 
PREVIOUS NEXT
Tagged: #javascript #function #length
ADD COMMENT
Topic
Name
4+7 =