Hey guys,
I am trying to add the returned value from the test()
function into a the variable result, but +=
does not seem to work. I get the error "invalid variable initialization".
I also tried replacing i++
to i+=
which didnt work either. Maybe I'm totally wrong and should use a while loop instead? I'm quite lost..
I want 'result' to look something like this:
var result = no no no 0no 0no no;
etc (with no whitespace ofc).
Any help much appreciated! Thanks
function test(no){
if (no <= 15){
return '0' + parseInt(no);
}
else {
return parseInt(no);
}
}
for(i = 0; i < pics.length; i++){
var b = pics[i].value;
var result += test(b);
}