5 ms·
The join() hack used to be significantly faster for many/long strings a couple years ago, but I wouldn't be surprised if things have changed since then. I'd be
by bulatb 13y ago
The join() hack used to be significantly faster for many/long strings a couple years ago, but I wouldn't be surprised if things have changed since then. I'd be interested to see your results.
Edit: Apparently the loop is faster.[0] :)
[0] https://news.ycombinator.com/item?id=7149833 https://news.ycombinator.com/item?id=7149833
- vkjv 13y agoThe loop doesn't even do the same thing since it adds an extra space at the end. Fixed: http://jsperf.com/spacify/4 http://jsperf.com/spacify/4