Most efficient way to concatenate strings in JavaScript?

The Solution to Most efficient way to concatenate strings in JavaScript? is


Seems based on benchmarks at JSPerf that using += is the fastest method, though not necessarily in every browser.

For building strings in the DOM, it seems to be better to concatenate the string first and then add to the DOM, rather then iteratively add it to the dom. You should benchmark your own case though.

(Thanks @zAlbee for correction)

~ Answered on 2013-05-22 16:16:38


Most Viewed Questions: