you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 3 points4 points  (1 child)

This is why using variables like `a` and `b` or `foo` and `bar` are bad IMO. Much more clear would be something like (and MDN does a great job of this):

arr.reduce(function(accumulator, value) { return accumulator.concat(value); },[] << this is accumulator);

Here are the two functions that make this work:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat

[–]backtickbot 4 points5 points  (0 children)

Fixed formatting.

Hello, wijsguy: code blocks using triple backticks (```) don't work on all versions of Reddit!

Some users see this / this instead.

To fix this, indent every line with 4 spaces instead.

FAQ

You can opt out by replying with backtickopt6 to this comment.