Compute sum of integers

JavaScript

var x = [1, 2, 3]
var s = x.reduce((a, b) => a + b, 0);

console.log(s); // 6