I am doing the following:
var var1 = 58;
for(var i=0;i<10;i++){
if(("var"+i) == 58) {
console.log("they are equal");
}
}
Could somebody explain me why ("var" + i) is not getting the value 58?
I know the first one is a variable and maybe the second is only a string, is that it? Is there any way of making this work?
I know I might be asking something quite obvious for many, but I am just starting. Any help appreciated! :)