let str;
let displayedNum;
for (let i in imgURLArray){
str = "<li photonum="+i+">" + "<a>"+ (1+i) + "</a>" + "</li>";
$("ul.selection-list").append(str);
}
While looping through, I encountered an issue where it incorrectly prints out "11" instead of "2" because it converts to a string before performing the addition.
Even when attempting to store the result of the addition in a variable outside the string, it still converts to a string instead of executing the addition.
Even using Number(1+1) results in it being converted to a string before converting it to a number, leading to the output being "11".