Math.sum or a likewise, baked in API. Fear not -- summing an array of numbers is easy using
const numbers = [1, 2, 3, 4];
const sum = numbers.reduce((a, b) => a + b, 0);
0 represents the starting value while with
b, one represents the running total with the other representing the value to be added. You'll also note that using
reduce prevents side effects! I'd still prefer something like
Math.sum(...numbers) but a simple
reduce will do!
new Element Madness
The first way to create UI-driven...
Tabular data can oftentimes be boring, but it doesn't need to look that way! With a small MooTools class, I can make tabular data extremely easy to read by implementing "zebra" tables -- tables with alternating row background colors.
The above CSS is extremely basic.