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,429
  • 9
  • 19

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
  • 60,351
  • 6
  • 44
  • 64