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?
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?
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.