Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript average of arguments

const average = (...args) => args.reduce((a, b) => a + b) / args.length;

// Example
average(1, 2, 3, 4);    // 2.5
Source by 1loc.dev #
 
PREVIOUS NEXT
Tagged: #javascript #average #arguments
ADD COMMENT
Topic
Name
1+1 =