This has this TypeScript example (complete with the missing let or const leading keyword) of making a mess based on all of the things in an array which gives us a six.
total = [0, 1, 2, 3].reduce((a, b) => a + b);
alert(total);
In JavaScript:
total = [0, 1, 2, 3].reduce(function (a, b) { return a + b; });
alert(total);
Addendum 6/21/2018: The a here is the counter that progressively goes up and the b is the item at hand at each pass.
No comments:
Post a Comment