You are extending the built-in type String. This may have unintended consequences on other objects using this built-in type. Consider subclassing instead.
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.
When iterating over the keys of an object, this includes not only the keys of the
object, but also keys contained in the prototype of that object. It is generally
a best practice to check for these keys specifically:
varsomeObject;for(varkeyinsomeObject){if(!someObject.hasOwnProperty(key)){continue;// Skip keys from the prototype.}doSomethingWith(key);}
Loading history...
12
a = a.replace(new RegExp("\\{" + k + "\\}", 'g'), arguments[k]);