Get average value of arguments


PHOTO EMBED

Mon Jan 25 2021 14:19:03 GMT+0000 (UTC)

Saved by @aymanelya #javascript

const average = (...args) => args.reduce((a, b) => a + b) / args.length;
average(1, 2, 3, 4);
// Result: 2.5
content_copyCOPY

https://radiant-brushlands-42789.herokuapp.com/medium.com/dailyjs/13-javascript-one-liners-thatll-make-you-look-like-a-pro-29a27b6f51cb