String concatenation vs string buffers in Javascript

后端 未结 7 2013
清酒与你
清酒与你 2020-12-24 14:24

I was reading this book - Professional Javascript for Web Developers where the author mentions string concatenation is an expensive operation compared to using an array to s

7条回答
  •  温柔的废话
    2020-12-24 14:50

    Even if it were true and the join() was faster than concatenation it wouldn't matter. We are talking about tiny amounts of miliseconds here which are completely negligible.

    I would always prefer well structured and easy to read code over microscopic performance boost and I think that using concatenation looks better and is easier to read.

    Just my two cents.

提交回复
热议问题