5 ms·
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 boole
by d4n3 12y 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
- mschoebel 12y agoAll the functions in that code return numbers.
- d4n3 12y agoAh ok. At first glance it looked like he was putting together something like an url.
- alexsop2 12y agoMaking [`.reduce`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) a significantly better choice.
- deleted 12y ago[deleted]