Programming-Idioms

History of Idiom 54 > diff from v33 to v34

Edit summary for version 34 :
New JS implementation by user [bijection]

Version 33

2019-09-26, 17:28:02

Version 34

2019-09-26, 17:41:38

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Idiom #54 Compute sum of integers

Calculate the sum s of integer list x.

Code
var s = x.reduce((a, b) => a + b)
Demo URL
https://jsfiddle.net/4yswkvfr/1/