JSFiddle - React, Tailwind, and code Playground
by brigand
TypeScript
const data = [1,2,3];
console.log(data.reduce((a: number, b: number) => a + b, 0));
//var total = (data)?data.reduce((a, b) => { return a + b }):0;
//console.log("total is : " + total );
/* var ints = [0, -1, -2, -3, -4, -5];
ints.filter(x => x > 0) // removes all elements
// .reduce((x, y) => x + y, 0) // the initial value is the neutral element of the addition
console.log(ints) */