The key to keep in mind is that Sawtooth Script is always evaluated before JavaScript. Your code creates a variable "i" in the JS and tries to pass that variable to Sawtooth Script, but the Sawtooth Script is already done by that point. So what you need to do is rework the code so that all Sawtooth Script is done independently of the JS.
Fortunately, the Sawtooth Script function "ListValuesArray" was made exactly for situations like yours. This function creates a JS array with all the info you want, then the JS can just use that array rather than using Sawtooth Script with "i."
var arr = [% ListValuesArray(q27ConList) %];
for (var i = 1; i <= 50; i++) {
var inConstList = arr.indexOf(i) != -1;
if (inConstList) {
Arr_RowList.push(i);
}
else {
Arr_RowList.push(0);
}
}