Rule Definition
When placed in a loop, string concatenation in typescript us a costly operation. Strings are immutable, this creates unnecessary temporary object and results in quadratic rather than linear running time.
Remediation
It is recommended to avoid using the concatenation of the strings in a loop.
Violation Code Sample
var ls = ['India', 'China', 'France']
function f1(limit : number) {
var i = 0;
while (i < limit ) {
console.log(a.concat(ls[i]));
i++;
}
}
Related Technologies
Technical Criterion
CWE-1046 - Creation of Immutable Text Using String Concatenation
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.