I have an array that I want to loop with a for.
for(var j = 0; j < outPutData.length; j++)
{
if(outPutData[j].pregunta1==1) { }
}
pregunta1, pregunta2, etc. are some of the variables.
If I print the value of outPutData[j].pregunta1 with an alert() it shows the correct value, but when I try:
for(var j = 0; j < outPutData.length; j++)
{
if(outPutData[j].pregunta+j==1) { }
OR
if(outPutData[j].pregunta+""+j==2) { }
}
an error is shown. Why?
What I expect to have is
outPutData[j].pregunta1
outPutData[j].pregunta2
outPutData[j].pregunta3
... (more till 200)...
outPutData[j].pregunta200
What am I doing wrong?
Thanks!