Does JavaScript have a built in stringbuilder class?

前端 未结 10 1627
Happy的楠姐
Happy的楠姐 2020-11-30 19:33

I see a few code project solutions.

But is there a regular implementation in JavaScript?

10条回答
  •  无人及你
    2020-11-30 20:21

    I just rechecked the performance on http://jsperf.com/javascript-concat-vs-join/2. The test-cases concatenate or join the alphabet 1,000 times.

    In current browsers (FF, Opera, IE11, Chrome), "concat" is about 4-10 times faster than "join".

    In IE8, both return about equal results.

    In IE7, "join" is about 100 times faster unfortunately.

提交回复
热议问题