0
I’m going to add values to a variable inside a for as follows:
function gerarcods(){
var alfa = $("#nalfa").val();
var qtdcods = $("#nqtdcods").val();
codigos = "";
for(i = 1; i<= qtdcods; i++){
str = alfa+i+",";
res = codigos.concat(str);
}
}
However, this way, the value of res is superimposed (obviously). The intention is that the string looks like this: "alfa1,alfa2,alfa3...". I wonder if there is a function to add a content to the string without losing its previous value.