Hacker News new | ask | show | jobs
by d4n3 4123 days ago
It's way better to use [values].join('') here... It's probably faster and it coerces all values to string.

If the first couple of results were numbers or booleans, they would be summed:

    > true + 10 + " result"
    11 result

    > [true,10," result"].join('')
    true10 result
1 comments

All the functions in that code return numbers.
Making [`.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) a significantly better choice.
Ah ok. At first glance it looked like he was putting together something like an url.