JS strings "+" vs concat method
In JS, "+" concatenation works by creating a new String
object.
For example, with...
var s = "Hello";
...we have one object s.
Next:
s = s + " World";
Now, s is a new object.
2nd method: String.prototype.concat
MDN has the following to say about string.concat()
:
It is strongly recommended to use the string concatenation operators (+, +=) instead of this method for perfomance reasons
Also see the link by @Bergi.