Compute sum of integers

JavaScript

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

document.write(s); // 6