Why is JavaScript two-sided string literal interpolation not quadratic?

In JavaScript, why is this classic quadratic-append not O(n²)?

s = "";
for (i = 0; i < 1000000; i++) {
  s = `( ${s} )`
};
console.log(s.length)

It’s O(n) in both Firefox 124 and Chromium 123.

In Python, it’s O(n²) as expected:

s = ""
for i in range(50_000):  # increase by 2x, gets 4x slower
  s = f"( {s} )"
print(len(s))

What is this magic, how are browsers cheating here?
Is that behaviour guaranteed by the ECMAScript spec?