Not in current engines, but the reason is an engine optimisation, not the language.
The spec defines + on strings as producing a new String value, the concatenation of the two operands' code units; no string is ever modified in place. It says nothing about cost. Implemented naively, every s += piece would allocate a new buffer and copy all of s, so a loop building an n-character string would copy O(n²) characters.
In V8, + usually doesn't copy. Its source describes a ConsString: a pair of pointers to two other strings, which can themselves be ConsStrings, forming a binary tree (a rope) whose leaves, read left to right, are the value. Appending creates one small node, so a += loop costs about one allocation per iteration. Results shorter than 13 characters are copied into a flat string instead, because a node isn't worth it.
The copy happens later, once: V8 flattens a cons string by allocating one sequential string with all the characters, and turns the original into a degenerate cons whose first part is that flat string. It does this when an operation needs the characters in one contiguous buffer.
V8 uses the same idea for substrings: a SlicedString (also 13+ characters) stores a pointer to the parent plus an offset and length instead of copying.
Practical answer for an interview:
- Write the clear version.
+=, template literals andarray.join('')all perform well in V8; profile before "optimising". joinstill reads better when pieces are already in an array or need a separator.- Engine specifics change; SpiderMonkey and JavaScriptCore have their own string representations, so don't build on one engine's thresholds.