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!
The ability to place content into a user’s clipboard can be extremely convenient for the user. Instead of clicking and dragging down what could be a lengthy document, the user can copy the contents of a specific area by a single click of a mouse.
I love to look around the MooTools Forge. As someone that creates lots of plugins, I get a lot of joy out of seeing what other developers are creating and possibly even how I could improve them. One great plugin I’ve found is…