you can do it like this
var ja[10];
...
i=0;
while (i<10) // another thing: This has to be i<10 not i<=10
{
ja[i] +=a;
i++;
}
you could also do it with for(){} ...but this should work, too
but in your first code:
if(a == 0) [...] ja1 += a; [...] - does this really make sense?!
and be a bit careful...
the first var in this array is ja[0] - not ja[1]