Is String.concat slower than Array approach to join strings

Posted by Rajat on Stack Overflow See other posts from Stack Overflow or by Rajat
Published on 2010-04-24T05:48:39Z Indexed on 2010/04/24 5:53 UTC
Read the original article Hit count: 206

Filed under:

Strings in JavaScript are immutable. Across the web and here on Stack Overflow as well, I came across the Array approach to concatenate strings:

var a = []; 

a.push(arg1,arg,2....);
console.log(a.join(''));

I know that this approach is better than the simple

console.log(arg1 + arg2 +.....);

for reasons of skipping creating intermediate objects but how does it fair better against :

arg1.concat(arg2,arg3.....);

© Stack Overflow or respective owner

Related posts about JavaScript