Let's assume you have the mean stored in a variable called 'mean' and the values are in an array called 'values' of length n. Then the way to calculate SD in FormCalc is: sum=0;
for i=0 upto n step 2 do
sum=sum + Math.pow(values[i]-mean,2);
endfor
SD = Math.sqrt(sum/(n)); in Javascript sum=0;
for (...