0

Especially when dealing with DOM objects in JavaScript, there are often duplicates of one and the same string.

Should such a string saved in a global variable (or constant) or is JavaScript optimising by itself?

Denis Giffeler
  • 1,499
  • 12
  • 21

1 Answers1

1

Most likely there is an intern pool that gets used, but this is completely implementation dependent since the ECMAScript spec. doesn't tell vendors how to implement the functionality.

Scott Marcus
  • 64,069
  • 6
  • 49
  • 71