I usualy do not use JS if it can be avoided, but I need it now, and I am stuck a bit.

testStart = 1 ;
testStop = 1 ;

function someTest (arg) {
var somevar = eval ( 'test' + arg ) ;
// this sets somevar to have value of testStop if arg passed to function was 'Stop'

what I would like to do is to increment value of testStop for 1 , so the next time this function is called, testStop has value of 2 . This example is typed just for this post. In real life there is varable number of vars (testStart, testStop ....). Is there a way to do this without using if statements. Maybe something like:

refvar = referenceToVariableCalled ('test' + arg) ;
refvar ++ ;
... and this would increse value of testStop for 1

}


Thanks for reading